Questions tagged [xna]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
6 views

Monogame/XNA - How do you resize a Texture2D and then scale it?

Problem: It seems like the Draw() call allows us to use either Destination Rectangle for resizing (5of8) or Scale (6of8/7of8) but not both. Purpose: I would like to resize a button from 567x634 to ...
0
votes
0answers
24 views

How do I change a specific set of spawned buttons from gray to green?

I'm a self-taught programmer. I have a button class runs like this: ...
0
votes
2answers
93 views

How would you go about placing objects between chunks in a 2D game?

I have a 2D infinitely generated world which is split up into 9 chunks at a time. Three chunks are loaded and three are unloaded whenever a player moves into a new chunk (if the player moves up a ...
2
votes
1answer
63 views

MonoGame game running slowly

Through development I've been running my 2D game (Monogame 3.6) on my windows laptop, which has some crummy integrated graphics card and an i5. Now I try my game on my gaming PC, which has a GTX 970 ...
1
vote
1answer
114 views

Monogame - Collision not working and invisible walls

I have recently been experimenting with Monogame and XNA (moving from Gamemaker) and decided to work on a simple collision system. Problem is shown in the GIF. Main Collision Each entity (Quick name ...
0
votes
0answers
67 views

How can I make the screen scroll only when the character is close to the edge?

On the internet, I saw videos and tutorials about screen scrolling. But those only show how to keep the player always in the center of the camera. I want my camera to scroll over the level, following ...
1
vote
0answers
71 views

Implementing a scrollable Panel in XNA/MonoGame

I am trying to create a scrolling Panel for my game. The code I've shown below works but there is a problem. I read Andrew's answer here and decided to implement the scrolling effect by using a ...
1
vote
1answer
97 views

How to add a animation to myPlayer

I'm currently making a shoot em up in monogame. I want to add just one animation to my object. No commands or transitions between animations for different actions: just an object swapping between ...
0
votes
1answer
36 views

Blender export does not render correctly in Monogame

I am using Monogame 3.7.0.7 on Linux and Blender. I have exported my model using the "FBX 7.4 Binary" exporter. Here is a render from Blender: However, when ...
1
vote
1answer
98 views

Collision detection problem in monogame C#

...
1
vote
1answer
106 views

My position is “changing” when handling animation

I'm trying to learn Monogames(Old XNA) and how to develop a 2d game. I'm in the process of animating my sprites. It works but there are somethings that are weird to me. For some reason when ...
1
vote
1answer
47 views

Why isn't my vertical scrolling functioning properly?

I'm trying to make a simple 2D platformer in XNA, but I'm having trouble with the vertical scrolling. What I'm trying to accomplish is that whenever the player is above half the height of the screen,...
0
votes
1answer
118 views

How can I do a Metroid like transition between two tilemaps with Monogame Extended?

I want to do a transition like those in the Metroid games. Here is an example of what i mean: https://www.youtube.com/watch?v=RKJ3MAi0ZI0. You enter the door, the screen fades to black and the camera ...
0
votes
1answer
39 views

How to check if a custom Control is focused?

So I am building custom UI for my MonoGame project. I've gotten pretty far already, having created Controls such as: Button Panel TextBox Form ComboBox CheckBox etc. All of these controls obviously ...
0
votes
1answer
82 views

Draw a texture2D at specific coordinates on another Texture2D

I have a ShipTexture and a Sail Texture. I need to draw the sail texture at a specific location on the shipTexture (call it the sailMountPoint) regardless of the location vector associated with the ...
1
vote
0answers
28 views

MonoGame game does not work on other pc, when installed by WiX

I made a simple tetris game. I wanted to give it to my friend, so that he could test it. I made very fast WiX project and setted up every file from bin/Debug. On my ...
1
vote
2answers
61 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 a Texture2D field when need be. I do not ...
0
votes
1answer
41 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
113 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
81 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 ...
3
votes
0answers
114 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
27 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
68 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
78 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
54 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
250 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
248 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
227 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
160 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
2answers
241 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
106 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
148 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
289 views

MonoGame / XNA Texture2D.SetData results in black texture

I use the following method to draw a box onto the screen: ...
1
vote
0answers
66 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
171 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 ...
3
votes
0answers
196 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
201 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
792 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
vote
1answer
82 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
118 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
1answer
29 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
1answer
124 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
44 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
422 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 ...
1
vote
1answer
280 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
819 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
520 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
392 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
2answers
104 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
86 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 ...