Questions tagged [xna]
XNA is a game framework by Microsoft that allows deployment for Windows, Windows Phone & Xbox 360.
3,078 questions
1
vote
1
answer
67
views
Move mouse from one viewport to another
I am currently implementing a map editor for a 2D platformer and run into trouble with my viewport and mouse movement.
I have two viewports: one main viewport in the top 2/3 of the screen which has a ...
0
votes
2
answers
126
views
Weird behaviour with SpriteBatch.Draw in MonoGame
I'm creating a rhythm game. I'm trying to move automatically Notes from upside but something went wrong. Notes just stuck.
Below is code, thanks in advance for help because I don't understand what I'...
0
votes
1
answer
192
views
Is there a simple way to find where our code is keeping references to disposed/pooled objects?
In our c# game we use object pools to store sprites once the Dispose() method gets called.Then when the Sprite.Create method gets called if a sprite is in the pool it gets depooled, cleared and ...
0
votes
1
answer
328
views
How to make 3D particles in Monogame?
I have made a 2D game and right now I am converting it to a 3D game. All fine so far, only for the particles I had used the particles library from monogame extended but this library only supports 2D ...
0
votes
1
answer
301
views
Apply bloom effect to RenderTarget without affecting UI
I'm currently rendering my whole game to a RenderTarget in order to stretch the scene to any resolution. I also have a bloom effect rendered with the scene. I'm now ...
0
votes
1
answer
826
views
Drawing Textured Quads
I've been starting to write some XNA / Monogame code lately, and wanted to draw a quad with a Texture2D attached to it.
After searching the internet for a while, I've come up with this render code:
<...
0
votes
1
answer
85
views
Rotate and Zoom a group of tiles
I'm working on a tile-based game and I'm trying to rotate my tiles as a group around the center of the screen and want to have the ability to zoom in and out. Here my code:
...
1
vote
1
answer
172
views
Best way to draw a tile (a floor) all over the screen?
I wanted a tip, a guidance perhaps to know the best way to draw a tile all over the screen. This tile is a 16x16 tile that should be the floor in my top-down map. I set my resolution to 1280x720 and i ...
1
vote
1
answer
113
views
Meshes seem to get distorted when I use rotate or zoom transforms (XNA/Monogame)
Whenever I seem to create a rotation matrix or try to zoom, the meshes that I draw to the screen get stretched and distorted.
I've tried to make a simple rotation matrix like this:
...
3
votes
1
answer
291
views
Proper way to build sensible object graphs?
The Context
I'm currently working on a game and its engine using C# and MonoGame. The engine is data-driven and I want people to be able to mod the game or make their own using my engine. All the ...
2
votes
1
answer
494
views
Floats vs. Ints for position and collision
So I’m writing a player class and using floats to store the positon and velocity (Vector2) as well as using it when drawing. When it comes to collision I get the player bounds using this code:
...
0
votes
0
answers
231
views
How to mask 2D tile sprites
I want to use masking technique to be able to reuse tiles. Basically I have the base texture and an array of masking textures for different corners and positions and want to combine the two to get a ...
0
votes
1
answer
2k
views
Something goes wrong when using System.Diagnostics.Process.Start to open a Monogame project
I am trying to develop a menu application for a homemade arcade. However, when I use Process.Start(path) to open my monogame projects' ...
0
votes
0
answers
249
views
Basic Projection & View matrix
Currently writing a camera component for FNA (basically XNA), and can't for the life of me figure out why my matrix transform isn't working as expected. This is how I calculate my view & ...
0
votes
1
answer
361
views
How to handle objects on 2D Map
I am making a 2D RPG game in Monogame XNA. For the moment I have 2 kinds of data in my game: sprites objects and tiles.
All the sprites are contained in a array list. I iterate over the sprites ...
0
votes
1
answer
423
views
How to do topdown collisions properly?
I'm trying to achieve grid/tile based collisions like "a link to the past"; here is an article showing it off (sliding off the corners and such). I'm currently using this type of collision ...
0
votes
1
answer
158
views
How can I find the direction a sprite is moving?
I'm trying to get the direction a sprite is moving (up, down, left, right). My current approach is to get the x and y coordinates of the target and the sprite (the sprite is the thing that I'm trying ...
0
votes
1
answer
1k
views
Window handle is invalid
I'm trying to implement an input listener for FNA (modern version of XNA). Since FNA does not supply any sort of way to listen to native input this has to be done through the windows API and native ...
0
votes
1
answer
280
views
How to select a sprite with the mouse in c# XNA?
I'm attempting to create a chess game, for the movement I need to be able to click on a piece with the mouse, and then the square I'd like to move it to. Each piece on the board is a sprite, and I'm ...
0
votes
3
answers
226
views
How do I show only the level in monogame? [closed]
How do I remove the blue background shown here
So that only the level is visible without making the sprites/map larger or the window smaller?
0
votes
1
answer
136
views
XNA configuration on legacy code
Background:
Our biomechanics and Advanced Surgical Technologies Lab wrote a surgery navigation system desktop application in C# around ten years ago. One of its major functions uses XNA Game Studio 4....
1
vote
0
answers
265
views
Matrix transforming with translation/rotation/scale at center of screen
I'm trying to create a camera using matrix transforms, the gist is as follows:
...
0
votes
1
answer
190
views
how to order entities by their distance from 0 on the x axis
I'm creating an infinite runner game in which you control several characters at once. Right now when you press the spacebar, they all jump at once but, I want them to jump at separately, one after ...
0
votes
1
answer
87
views
Complex mesh (created in Blender) is not overlapping when rendered in Monogame (XNA)
community. Just started playing with Monogame and stuck with a quite simple, but still unanswered issue, at least I couldn't find any answer.
The model rendered in Monogame (XNA) is not overlapping ...
0
votes
0
answers
64
views
How do I export an XNA crossplateform project to Nintendo 3ds or Nintendo Switch? [duplicate]
I would like to document my self a bit about 3ds and switch game creation. I know that modern game engine have builtin tools to export games to these platforms, but I could not find - in google ...
2
votes
1
answer
464
views
Getting Rendered Sprite Size
I need the rendered dimensions of a sprite, I'm calling Draw in the class below:
...
2
votes
1
answer
179
views
Frame-rate drops when drawing 2D map tiles
Update: I figured out it has nothing to do with the camera but instead framerate drops when drawing my map tiles onto the screen.
Here’s a link to a video showcasing the bug in action (For further ...
0
votes
1
answer
129
views
Game() parametters Content and Window are not pre initialized
I've been experiencing a really Strange problem since recently, Every variables of XNA Framework Game class seems not to be initialized before my extending Game1 class. Variables does not seem to be ...
1
vote
0
answers
735
views
Playing Video for Splash screens etc using Monogame
I've been searching around on internet a way to display a video using XNA/Monogame. But everything tend to go in the direction of the class Microsoft.XNA.Framework.Media.Video. Unfortunatly, my xna ...
0
votes
1
answer
462
views
How to flip a rectangle
I'm curently working on a system that make the player character look towards the mouse pointer.
My system is effective but i'm having an issue while displaying the rectangle.
In the Following code i ...
0
votes
1
answer
531
views
Check if point is inside convex hull
I first tried with a simple axis aligned bounding box to test my algorithm (later shape will be different but always convex 6 faces), but even this case did not work, it always tells me that the point ...
0
votes
3
answers
840
views
XNA Rotate Vector2 around Origin
I have a Rectangle and a Vector2 position, my sprite is being drawn at this position. The rectangle is meant to be a collision system with the cursor, when I rotate my sprite around the origin and ...
1
vote
2
answers
989
views
Monogame - SpriteFont Exception: Text contains characters that cannot be resolved by this SpriteFont
I'm trying to put text on the screen and if I put anything but an empty string I get "Text contains characters that cannot be resolved by this SpriteFont.\nParameter name: text"
...
0
votes
0
answers
387
views
Sprite Distortion (Ghosting While Moving and Artifacts when Mirroring to External Display)
I am working on my first MonoGame project. I love the framework so far!
I have implemented my own letterbox/pillarboxing to scale my native resolution by the maximum integer scale allowable on my ...
2
votes
1
answer
365
views
Sprites looks blurried on fullscreen
I'm trying to make a pixel art game and my resolution is 384 x 224, but when I change to fullscreen the sprites looks blurry and I don't know how I can disable bilinear filtering.
I tried ...
0
votes
0
answers
86
views
HLSL Xna Deferred light issue
My point lights seem to have problems when the camera is far away… is it the depth map? Anyway i'll show you the code
Here is my GBUffer fx :
...
0
votes
0
answers
252
views
0
votes
1
answer
63
views
How to stop movement from moving multiple spaces when a directional key is pressed
I am making a 15 piece puzzle game and having difficulty making my sprite move one tile at a time, when i initially press the left key the sprite moves once, but after that the sprite moves multiple ...
1
vote
1
answer
3k
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 ...
1
vote
0
answers
54
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
2
answers
812
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
1
answer
653
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
1
answer
494
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
0
answers
205
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
0
answers
816
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
1
answer
226
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 ...
1
vote
1
answer
135
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
1
answer
406
views
1
vote
1
answer
358
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
1
answer
109
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,...