Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [xna]

XNA is a game framework by Microsoft that allows deployment for Windows, Windows Phone & Xbox 360.

0
votes
1answer
31 views

XNA: Classes with Texture2D to be treated as one

Summarised Problem: I have an "Animation" class that I want to be able to treat as its Texture2D field when need be. I do not want to inherit from the class or its parents. I'd rather not create a ...
0
votes
1answer
34 views

Simplify Matrix math code- Sun billboarding

If was trying to set the correct position of my sun billboard in my 3d game. I tried long until it worked correctly, but I wonder why this code must be so complicated: ...
0
votes
0answers
52 views

XNA 4.0 C# How to draw cube with the index method

EDIT NOTE: I was trying to impliment indexing to my code instead of instancing. I left the indexing method because in my case, I don't need to use it. Preview Untill now I have drawed my cube with ...
0
votes
1answer
41 views

XNA 4.0 How to combine triangles vertices 3D

Preview for the problem: I'm making a similar game to Minecraft (a game that it's world is made by cubes), but the fps of the game is getting low only by rendering a little amount of cubes in the ...
2
votes
0answers
61 views

Trying to get Vertexshader to work Monogame 2D

If I don't use the vertex shader, it gives me white textures which is what the default color is. Once I add the vertex shader, the screen is black. I figure it is something wrong with the Matrices I ...
1
vote
0answers
19 views

XNA - How to scale sizes and speeds for a minimap?

I'm recreating the arcade game StarGate, and I need to create a minimap. But I'm having problems scaling the minimap textures to fit in the radar box, and ontop of that, making sure the speed of the ...
0
votes
1answer
26 views

XNA 4.0 How to change GraphicsDevice Default DepthStencilState Value

I want to change one of the deafult values of my GraphicsDevice to that: GraphicsDevice.DepthStencilState.DepthBufferEnable = true; But I know only to change it ...
1
vote
1answer
61 views

What are the semantics of these quaternion functions in XNA/Monogame?

I am having trouble understanding the semantics of some members of the XNA/Monogame Quaternion class. The docs are not helpful, and tutorials trying to explain ...
0
votes
0answers
32 views

Cannot deploy MonoGame project to BlueStack (ADB0000: closed)

I'm using MonoGame 3.6 with Visual Studio 2017 Community and I'm trying to deploy to BlueStack as Android emulator. VS can see Bluestack and permit me to launch deploy but ends with this error: ...
1
vote
2answers
155 views

How to make a Blend-Effect like yomawari did?

I would like to know, how to make that effect, I have seen in the game named Yomawari. The little girl has a lamp and its cone revals the dark spirits around her. But only if they are in the light. I ...
0
votes
1answer
104 views

Texture Atlas and HLSL Shader for sprite tiling

I am trying to create a shader that allows to tile a specific region of a texture. This seem to be a common need however I can't seem to find any information about how to get this effect done. The ...
0
votes
1answer
37 views

HLSL Manual Alpha Blending

I'm trying to do alpha blending manually because I only want to apply alpha blending on certain pixels. Underlying is the texture I'm writing to. This is what I got so far, but it doesn't give the ...
0
votes
1answer
91 views

Most efficient way to remove a Rectangle ? Monogame/XNA

I have a project in which I'm trying to remove the "collision box" (Rectangle class) of one of my enemy. My game logic basically is: ...
0
votes
1answer
90 views

Element's texture is null - Monogame/XNA, C#

I have a ArgumentNullException everytime I try to call the Draw() method of my Projectile class in the Game1.Draw() method. In Game1.cs Initialize() method: ...
1
vote
2answers
82 views

How should I be loading a player's content and its bullets content later in the game

I'm trying out Monogame because my course has a simple game programming class in it which is just going over basics. The final project will be using Monogame so I've been getting ahead and making my ...
0
votes
1answer
56 views

Using multiple textures in Monogame HLSL Effect shader?

My Monogame HLSL shaders only successfully sample one texture (besides the screen). Any additional textures I try to sample end up with the same texture data as the screen. I've found people with ...
1
vote
1answer
127 views

MonoGame / XNA Texture2D.SetData results in black texture

I use the following method to draw a box onto the screen: ...
1
vote
0answers
37 views

Monogame Per Pixel Collision scale texture

I have a problem: I am learning the Per Pixel Collision, because I am very new to Monogame. Everything works thine, but my texture (image) is too big, so I scaled it down to 0.5f. Now it doesn't work ...
0
votes
2answers
123 views

C# Fastest way to iterate over certain tiles overlapping multiple chunks?

What's the fastest way of iterating over certain tiles overlapping multiple chunks in C#. Ideally without having to iterate over everything, just a specific set of coordinates? (green cubes example ...
2
votes
0answers
126 views

Viewport not matching Window size when fullscreen

I am using: GraphicsDevice.Viewport.Bounds to determine the size of the canvas / stage for my window. This works well if I am in Windowed mode, but if I launched ...
0
votes
2answers
141 views

TouchPanel.GetState() Returns wrong touch locations XNA

I am trying to make my Desktop game playable on IOS. I have a Button.cs class, which has this code in it: ...
1
vote
1answer
388 views

Issue importing TileMaps/TileSets in Monogame.Extended 1.0

I've just started coding my first ever videogame using Monogame/Xna. I've reached a point where I would like to start editing maps and importing them into my game using the program Tiled. After ...
-1
votes
0answers
37 views

Conversion from lat-long to Cartesian coordinates 's result is different with real location

I'm trying to put building from real lat-long in my Monogame app (4 buildings in my school, please check the image with the blue circles) But after some convert method, it went terribly wrong (please ...
1
vote
1answer
74 views

Destroying a ship removes both the ship and the bullets it has fired

So I'm making a game where you fire bullets at enemy ships which are flying past you. The enemy ships are also firing at a straight line in front of them. The bullets are made into a list of another ...
0
votes
2answers
97 views

Tile slopes and jittery movement

I'm trying to handle slopes in a tiles based world. I'm using basic linear interpolation to find the Y coordinate of the character based on his X position. But i have a problem, when the character ...
0
votes
0answers
11 views

Check Collision with rounded off objects [duplicate]

Alright, I am writing my first game on C#. Let's imagine I have got two classes: HeroEntity (has an X of type float, a Y of type ...
0
votes
1answer
26 views

Camera not in sync with player

I am currently working on a game in XNA and MonoGame. This game is supposed to be a port of KidsCanCode's tutorial series of creating tile-based games in Python. Here is a link to one of the videos in ...
0
votes
0answers
37 views

I want my mouse position to change when I move my player

So I set my camera following my player but I have a problem. When my player moves, the vector changes obviously but not my mouse position. I have to calculate the mouse angles of where I shoot my ...
0
votes
1answer
85 views

How to get tile rotation from TiledSharp and convert it to XNA/MonoGame

I am currently working on a game using XNA and Tiled. I use Tiled to create my maps and load them using TiledSharp. Some of my maps have tiles that are rotated by using one or more of the left rotate, ...
1
vote
1answer
43 views

Efficient way to avoid shadow “streaks” beyond bounds of shadow map

BACKGROUND INFO: Using MonoGame. To maximize shadow resolution, I've got a shadow map that covers only the area closest to the camera. (I am aware of Cascading shadow maps, but for now, I am ...
1
vote
1answer
298 views

System.Windows.Form.Control.FromHandle returns null for current window

I was following the book "XNA 4.0 Game Development By Example" and in the eighth chapter, the author adds windows form to an XNA game. I was following the book for a MonoGame project, but I get null ...
0
votes
0answers
117 views

Why do I see blurring lines when moving a camera, and how can I fix it?

I am using Monogame and I'm rendering the terrain as tiles. I am bringing in the tiles from Tiled. When I move my camera up, I get these lines that seem to be blurring the tiles together. Please ...
1
vote
1answer
155 views

Keeping 2D camera within game bounds

I have a simple camera class which works for following my character around, and has an adjustable zoom. However, I cannot figure out how to keep the camera within the bounds of the world. As far as ...
0
votes
2answers
506 views

Monogame Drawing Text

I'm really new at XNA. I've been following some tutorials at gameprogrammingadventures.org but when it comes to conversations I don't really like how the author does it so I've been trying to ...
1
vote
1answer
380 views

How do I prevent tile tearing effects when using pixel art in XNA/MonoGame while keeping the low velocity of the player?

Most of my Texture2D are pixel art, meaning they're rather small, so my player/character's position has to change using decimal points to keep a realistic movement that matches its walking animation. ...
0
votes
2answers
248 views

How to render many tiles fast if zoomed out? (Monogame/xna)

I'm currently trying to optimize my tile engine. I used monogame with the spritebatch first, but that doesn’t works well. I have read many articles how I could optimize my rendering code. I moved ...
0
votes
0answers
63 views

Monogame - how to have draw layer while on SpriteSortMode.Texture

I have a problem in which in my game I have to use SpriteSortMode.Texture because I have a lot of objects with few textures, so I cannot afford to use SpriteSortMode.BackToFront. The thing is this ...
0
votes
2answers
77 views

Xna/Monogame How to get an object to decelerate

So I've written a statement for releasing the ball based on a certain speed and for it to move in the direction of the mouse, like so: ...
0
votes
1answer
53 views

XNA triangle grid not drawn using DrawIndexedPrimitives

I have just recently started working with Monogame (XNA). Now I had code that was drawing a grid using DrawUserIndexedPrimitives. However I read that it reloads the vertices in the GPU each draw, and ...
0
votes
1answer
262 views

Trying to get an object to move in the mouse direction XNA C#

Right, so in my Player class where I call the object I got an if statement which gets the coordinates for the mouse ...
1
vote
1answer
76 views

Questions about “minecraft” game optimisation [duplicate]

I'm currently trying to do a basic "minecraft style" game. I know how difficult it is to create a game like this, that's why I juste want to do the base of a game like this. I did a class which ...
0
votes
1answer
49 views

Update sprite position when speed changes if frame rate is low

I have a sprite moving horizontally from left to right. For each iteration I want to start decreasing the speed. This works ok, and the sprite will stop at some point, however depending on the frame ...
0
votes
1answer
90 views

C# XNA How to work out minimum distance to decelerate and stop at a point

I am building a game in C# using XNA. I am currently trying to get a character to always travel to the middle of the map which is located a point (0,0,0). I want the character to accelerate to the ...
2
votes
1answer
303 views

Tilemap Collision w/ different height levels and directions

I've been programming a final fantasy 6 clone in C# using Monogame and Monogame Extended, and have met on a few interesting challenges regarding tilemap collision. The game seems to have different ...
0
votes
1answer
131 views

C# XNA Making a TextBox Appear to input the X and Y coordinates

Okay I'm trying to find a way to not have to hard code in my values for the x and y coordinates. so far I have hard coded these in when you press certain numbers on num-pad it'll move the camera to ...
0
votes
1answer
220 views

Changing the color data of an instance of a shared texture? MonoGame

I want to load multiple instances of a texture on the screen and be able to change the color of each one individually by clicking on it. I've tried many different ways and currently I'm creating two ...
3
votes
1answer
162 views

Why are .xnb files used rather than source files?

XNA and Monogame are built using a content pipeline, which takes source files (images, sound effects, 3D models, etc.) and converts them to proprietary .xnb files. What's the benefit of doing this as ...
0
votes
2answers
277 views

Is there a way to force a resolution on Android when using Monogame?

I think I looked everywhere but I couldn't find a way. My phone has a native resolution of 1920x1080 and I would like to run my game at 1280x720. I tried by changing PreferredBackBufferWidth and ...
0
votes
1answer
130 views

Monogame problem with flat shading low poly terrain

I have been dabbling in 3d rendering recently and I am having a problem with the shading on the mesh I am using. The code I am using to calculate the normals for all the triangles is as follows. <...
1
vote
0answers
70 views

XNA / Monogame Camera flickering on collision

I have my camera follow my player and it works perfectly, I had some issues with collision and managed to get it working, but now my camera follows my player when it gets pushed back so the camera ...