FAQ Database Discussion Community


Monogame “lighting” specific objects

c#,monogame,lighting
I have done something similar to this in Monogame: My question is, what would I have to do to draw that lighting effect only on the pillar and not the background ? Is there something like ignoring certain sprites when using BlendState.Additive ? How would that work ? Here is...

Foreach statement does not contain public definition for getEnumerator

c#,collision,monogame,enumerator
I am trying to implement collision between two paddles and I am getting the GetEnumerator error. This is where I am getting the error: foreach (Player item in paddle1) { item.Update(gameTime); if (paddle2.CollisionSprite(item)) { paddle2.Velocity = -paddle2.Velocity; } } And my Collision methods from Player: public virtual Circle CollisionCircle {...

Calling on existing classes? [closed]

c#,class,monogame
I'm quite stomped... I can't seem to find a straight answer for "How to call a method, or get a variable from another class". What I want to do is to let a second script to use a variable on the main script (Game1.cs), or to trigger a method. The...

Function of base.Update and base.Draw in Monogame?

c#,xna,monogame
I am following the basic Monogame tutorial from this website. What I can't figure out is why Game1.cs includes calls to base.Update and base.Draw? If I remove these function calls, it does not seem to affect my game in any way... Code Game1.cs protected override void Update (GameTime gameTime) {...

XNA Game with MonoGame on Mac

osx,xna,monogame
I have just moved over to a mac and I am continuing my development with XNA using monogame. However when I am trying to use Gamepad.GetState(index) and it is throwing the following error. System.IO.FileNotFoundException: Could not load file or assembly 'Tao.Sdl, Version=1.2.13.0, Culture=neutral, PublicKeyToken=9c7a200e36c0094e' or one of its dependencies. at...

When I pass a Texture2D as parameter to a class, this texture is null

c#,menu,xna,monogame
here is the code where I get the problem : namespace Menu_test { /// <summary> /// The main menu screen is the first thing displayed when the game starts up. /// </summary> class MainMenuScreen : MenuScreen { #region Initialization ContentManager content; Texture2D playgame; Texture2D exit; /// <summary> /// Constructor fills...

Rectangle's width increasing more than it should while trying to resize the rectangle

c#,tooltip,monogame
I don't think the title is on the spot. But please check the pictures below for a better demonstration. I have a rectangle which fits text in it. What I'm trying to do is that, if the rectangle's height is bigger than the screen, then the rectangle should resize. Resizing...

Smooth slow pixel art movement MonoGame

c#,monogame
When ever I move a sprite that is scaling using point filtering slower then 1 pixel for example 0.1 pixels the movement becomes choppy/jerky instead of moving in sub pixel movement it jumps from pixel to pixel. How can I make it move using sub pixel movement? Herse a video...

Monogame running very slow on Windows Phone

c#,windows-phone-8.1,windows-8.1,monogame
Recently, I decided to resurrect one of my old XNA game projects and port it to a Windows Universal App using Monogame. I managed to get the game running perfectly (albeit with a little less performance) on Windows 8.1, but ran into some huge problems with Windows Phone. First, it...

C++ GUI Challenge

c++,graphics,programming-languages,monogame
Recently I was challenged by a friend to create a snake game much like the classic Nokia version using the C++ language. I have been programming in Java, but unlike Java, C++ doesn't seem to have standard gui libraries. Therefore after looking into GUI for C++ many different api are...

MonoGame renderTarget2D Error

c#,runtime-error,monogame
I start the game and everything works but after about 15 seconts the game crashes and I get this error : Error : The combination of internal formats of the attached images violates an implementation-dependent set of restrictions. This is my code : using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework; using System.Collections.Generic; namespace...

Monogame sprite alpha blending

c#,monogame,alphablending,spritebatch
At the moment, I am having a 2D grid of terrain textures, which I am drawing using the standard XNA/Monogame spritebatch.Draw() function. In order to have smoother transitions between adjacent but different terrain textures, I would like to blend textures within a certain area (say 3x3) around a center texture....

Expression denotes a `type', where a `variable', `value' or `method group' was expected (CS0119) (MyFirstGame)

c#,monodevelop,monogame
I'm learning to program in C# using monodevelop and monogame. I'm fairly familiar with C and Java but in honesty, I'm still learning to think like an Object Oriented programmer. I wanted to use the following class to gather together relevant attributes of a sprite, together with methods to move,...

How to convert 8bit sound to 16bit

c#,vb.net,bit-shift,monogame
I'm using DynamicSoundEffectInstance to stream in raw PCM data. This data is 16bit and signed. My code works fine, not a single problem. The issue is compressing this raw PCM yields poor results: 13.9mb down to 13.7mb. If I encode the PCM data as 8bit signed values, and then compress...

How to check if Mouse is available in XNA - Monogame

c#,xna,mouse,monogame,win-universal-app
I'm using Monogame to develop an universal app for Windows Store and Windows Phone. I know that is possible to check if a TouchPanel is available and I'm looking for a method that do the same thing with a mouse. I can't ignore the fact that a mouse is not...

Is sidescroller movement just offsetting the background?, MonoGame

movement,monogame,side-scroller
When I make a sidescroller game and what to move my character do I just offset the background, or is there another better way?

Monogame XNA transform matrix for a single object?

c#,matrix,xna,monogame
I have read a few tutorials explaining transform matrices for XNA/Monogame. The problem is that these matrices are applied to SpriteBatch.Begin(...matrix); This means that all Draw code will be transformed. How do I apply a transformation matrix to a single drawable object? In my case I want to transform a...

SimplexNoise terrain in MonoGame

c#,monogame,procedural-generation,simplex-noise
I'm making a randomly generated tile game in MonoGame, and I'm trying to use Simplex Noise to generate the terrain. Problem is, I've never used Simplex Noise before, so as you can probably guess, my code doesn't work. It only creates grass tiles. Here's the code I've tried: public void...

Create MonoGame.Framework.iOS.dll

ios,dll,monogame
I have the known landscape problem with iOS 8 and MonoGame 3.2. I have read that if I download the newest code from github this will fix the problem. My issue is that I can't seem to build a working dll from what I have downloaded from github. Maybe I'm...

Creating a Tooltip rectangle and checking when the rectangle leaves the screen

c#,monogame
I am creating a Tooltip class. Generally, a rectangle will be drawn on top of the mouse position. If the rectangle hits the top side, or the right side, the rectangle would be drawn on the opposite side. This is my code for that: private int LeavesScreen(Rectangle rectangle) { const...

Xamarin using cross platform 3D engine

xamarin,xna,cross-platform,monogame
I am a iOS / Android developer who has started to look at Xamarin for Business apps. As a hobby I make the odd 3D game and one thing thats always got me is having to write it for 2 platforms (Yes I do know about Unity, not my bag)...

Sub pixel movement need 1 transparent pixel on the edge to move smooth

monogame,subpixel
When I move a sprite slower that one pixel everything moves sub pixel except the edges here's a Video : https://www.youtube.com/watch?v=zcai1PUfzzA&feature=youtu.be I think it does this because it isn't allowed to scale the image. If I add one transparent pixel to the edge of the image it does look like...

How to target the Windows Store from an existing Windows Application type of project

c#,.net,visual-studio,windows-store-apps,monogame
Is it possible to re-target a Windows Application type of project to be a Windows Store project? I am trying to see if I can re-target the latest version of the Farseer Physics Engine samples for MonoGame (.NET Framework targeted) to the Windows Store. I have tried searching but haven't...

How to save the response in a custom made popup dialog

c#,monogame
I'm trying to create a custom popup in xna that displays some text and adds the choice to select yes or no. Depending on the button selected, a value should be returned. I have everything pretty much set up, but I can't figure out how to do this particular part....

2D Monogame: Rectangle collision detection, side specific

c#,xna,monogame
I have two rectangles, one player, one map. The player needs to not be able to walk through the map. Both the player and map have a rectangle with position and texture width and height, both also have a Vector position. Rectangle.Intersect() only outputs a boolean value, I cannot figure...

Tile tearing with float positioning, MonoGame

monogame,subpixel
If I move my tiles using float coordinates lines appear between them, but if I use integers there is no tearing. How do I fix this without positioning them buy ints. The reason why I don't want to position them by ints is because then the movement will be choppy...

Ubuntu - MonoGame static graphics.Viewport size

ubuntu,graphics,monodevelop,viewport,monogame
I'm running MonoGame in MonoDevelop under Ubuntu and doing some tutorials, but I'm constantly experiencing a problem with the size of graphics.Viewport Each time I build an app, it doesn't matter if it is windowed or fullscreen. The resolution doesn't matter also. graphics.Viewport.Width graphics.Viewport.Height always return 800x480. Does anyone has...

Xamarin Signed Release apk will install but not run

android,visual-studio-2013,xamarin,monogame
I've been developing an app for a while and now I want to hand it out to friends for testing. The app works perfectly when debugging to my device but when I build and sign the apk and move it to my device I can install it without any errors...

Can’t Load .fbx from blender to Monogame correctly

c#,blender,monogame
I am using pipeline.exe tool, to convert an .fbx file I made using Blender (using the default Blender 2.73a export settings) to .xnb, and then manually copy and paste it in my content directory (Is this one of the correct ways to convert it properly ?). After watching this video...

simple 2d collision in monogame (using xna pipeline)

c#,collision,detection,monogame
I am just starting to learn monogame and I am using the XNA pipeline (search RBWhitiker) to create a 2d platformer, however I have become stuck when trying to get my player to jump on a platform. My player can run past the platform and jump, which is desired. The...

Create a big image out of several other small images in MonoGame

monogame
How can I create one big Texture2D out of several other small Textures2Ds? Then display that image instead of all the small images.