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
1answer
74 views

How do I make bullets in a list intersect with bullets from another list, when both lists are not in the same class?

I have the initial "Game1" class, with a "Ship" class initiated inside, and within the "Ship" class there's a List, where the "Bullet" class is used. How can I make a bullet in a list from one of the ...
0
votes
1answer
323 views

How do I offset a TouchPanel input in Monogame

I am creating my first 2D game in monogame. I have used RenderTarget2D to maintain a 4:3 aspect ratio. If it is played in a window of any other ratio it will offset the RenderTarget2D position to ...
1
vote
1answer
104 views

2D stop on collision

So, this is the code I have right now: ...
0
votes
1answer
215 views

How to convert Texture2DContent to Texture2D in custom ContentTypeReader

I'm trying to implement a custom ContentPipeline extension that writes a Surface object with a Texture2D member. My input file is an xml with fields for all of my Surfaces and their members. In the ...
3
votes
1answer
309 views

Keyboard input not working for me in derived class

My code is unable to accept keyboard inputs in a specific class. I know that I have used inheritance for that class, but I'm pretty sure that it is not the main reason why it doesn't work. Can you ...
0
votes
1answer
110 views

How can I get the position of a fixture in Farseer Physics 3.5?

I created a body(rectangle). After that, I attached a circle shape to the body. I need the position(world coodinates) of the circle shape because I want to draw a circle sprite(Texture2D) on that ...
3
votes
0answers
241 views

How to serialize an XNA Rectangle

I'm serializing a data structure to XML using the IntermediateSerializer class. This data structure has an XNA Rectangle in it. ...
1
vote
1answer
114 views

GraphicsAdapter.Adapters on openGL won`t return secondary monitor

I have been searching for this everywhere and never found the answer. I am developing a feature to allow the user to select which monitor to run the game. I have two monitors, primary and secondary. ...
2
votes
0answers
41 views

Models overlapping in XNA 3.0

I have to use XNA 3.0 for a class at school, and every solution to this problem I've found only works in XNA 4. I am rendering several 3D models, and the one that's drawn last is always on top. How do ...
6
votes
1answer
9k views

How to change screen resolution in XNA?

I'm making a 2D game in XNA/Monogame and I'm using Stardew Valley as a visual template (it's got the SNES style I'm going for). I'm having trouble mimicking the feature to change screen resolution ...
1
vote
1answer
608 views

Why do XNA/Monogame models create new BasicEffect instances?

My question is fairly straightforward, I think. Using Monogame, when I load a model using contentManager.Load<Model>("Model"), the model's mesh has a ...
0
votes
1answer
350 views

Sprite rotating to look towards mouse

I am trying to figure out how to calculate the angle to rotate a sprite in z axis to look towards the mouse. I declared one index -and vertexbuffer and set following vertices in it: ...
1
vote
1answer
372 views

Monogame/XNA Hardware Instancing problem

Here's a youtube video of my problem. https://youtu.be/1zB4q9_sNQI Look at how the hideous cube kinda slides into the terrain and rotates weirdly with the world and from above its vanished into the ...
0
votes
1answer
162 views

Send large amount of vertices to graphics card

I am programming at the moment a minecraft clone. The advantage of this clone is that the whole world is handled as a model. That means: The whole world is represented by 2d flat tiles and is ...
0
votes
1answer
630 views

TileMap collision detection

I'm currently working on a project in XNA and I'm trying to implement collision detection but can't wrap my head around how exactly i'm going to do it. I'm using the Tiled application to create my ...
2
votes
1answer
1k views

How do you create an over world styled like Pokémon Black and White, with both 2D and 3D elements?

The over world of Pokémon white uses 3D models for objects like houses, and 2D sprites for characters like the player. What would I have to do to create an over world styled like this? Here is an ...
1
vote
1answer
316 views

How does XNA/MonoGame project 3d to 2d?

I am trying to figure out how XNA is actually projecting a 3d world space coordinate to screen space. I decompiled the MonoGame framework and copied the CreateLookAt und CreatePerspectiveFieldOfView ...
0
votes
1answer
88 views

Why is my sprite leaving copies as it moves in Monogame?

I am pretty new to Monogame, and I'm trying to draw a character sprite and move it using keyboard. Instead of moving to different positions, it leaves a track of copies along the way. I have 2 game ...
0
votes
1answer
41 views

ArgumentNullException from SpriteBatch.Draw trying to get a Texture2D from a jagged array

first time on here. So I'm trying to make a tile based game in Monogame using some 2D arrays and spriteBatch.draw absolutely refuses to retrieve a Texture2D from an array, or something else is wrong ...
8
votes
2answers
4k views

Drawing huge amount of tiles in Monogame (XNA) efficiently

I'm asking this question because I haven't found a definitive answer to it. Let me first of all state a few things about the game and what I have already done. The game is a going to be a RTS set in ...
0
votes
1answer
52 views

Sprites With Vastly Disparate Scales

So, I'm developing a 2D game where I'm dealing with sprites with vastly different scales. I'm attempting to represent the scales accurately, where I have a 10-m wingspan fighter and a 1400-m carrier ...
1
vote
1answer
2k views

Position vs Destination Rectangle

I'm new to programming, and I finally delved into XNA/MonoGame for wanting to practice coding game logic. I'd like to know what the difference is between a Position (Vector2) and a Destination ...
1
vote
0answers
86 views

Pixel-perfect collision appear to have random behaviour

So I was sitting with my programming teacher with this issue for about two hours and we couldn't figure out anything specific that could possibly be the issue. Therefore I'm taking some measures and I'...
1
vote
2answers
2k views

How do I create my own GPU accelerated graphics API in C#?

I am creating 2D game engine in C# and I need some graphic API, so that user can draw sprites or convex vector shapes. I tried to use GDI+ for it. But I discovered that GDI+ is not GPU accelerated and ...
1
vote
2answers
582 views

Efficient way to render tilemap

I have set up a tilemap system, and am rendering it in a way that lets me pan through the map using a camera offset. However, I have discovered it is incredibly inefficient, but am unsure of how I ...
0
votes
1answer
158 views

ball reflection angles Xna c#

I'm trying to find a way to handle reflections for a breakout clone. I would upload an image to the post instead of the following paragraph, however i have not yet gained the privilege of that yet. ...
0
votes
1answer
80 views

Monogame Dragging 3D object edges

I am having trouble rendering 3D models with monogame. The problem only occurs when I export the object from blender with two materials on it. Example: Monogame sees those two different materials ...
1
vote
0answers
111 views

sprite jitter when max acceleration reached at camera

Camera seems making sprite jitter when max acceleration is reached : Thats my camera code : ...
-1
votes
1answer
195 views

XNA draw a rectangle 3D perpendicular to camera

I need some ideas how to implement the Draw method. Need to draw a rectangle (actually a million of them, all same texture) that is in 3D, starts at point ...
1
vote
3answers
217 views

Collision Detection works 2 sides

This might be really simple but it is giving me a lot grief and I wondered if you guys would be able to shed some light on it. Basically I have a tile map which draws tiles at 64 * 64 and that works ...
0
votes
1answer
127 views

tile map collision with player not working - 2D c# xna

Currently the tile map is drawing fine but I am not sure how to proceed with collisions between the player and some of the tiles. Would it be better to specify certain tiles that the player can't move ...
0
votes
2answers
177 views

Collision code is creating allocations on heap every frame

I've been profiling my app trying to reduce allocations and garbage collection during gameplay. The following code is SAT collision which i use for hill/ramp collisions, when the player is standing ...
3
votes
1answer
634 views

Rotating a sprite around its center

I also use Farseer Physics and Artemis ECS. Here is RenderingSystem Process method: ...
2
votes
2answers
104 views

Skip processing individual triangles or vertices of the mesh

In my game I have a billiard table, and a floor below the table. In typical situation the table covers 80% of the screen, so only small amount of the floor is visible. And I render the table first, so ...
3
votes
1answer
314 views

C# XNA colliders, physics, inclined plane/terrain/colliders

Currently I'm working on a project to learn game programming. But I'm not sure if I have the right approach on several things, and that's what I'm here for. What I'm trying to create is a small world ...
0
votes
0answers
149 views

monogame - how do I distribute a lib / package with content?

I wrote a UI lib for a monogame hobby project I'm working on, and I want to distribute the UI code / lib as open source for others to enjoy. My question is - what do I do with all the content that ...
0
votes
1answer
173 views

Error loading "SpriteFont1". File not found

I have an issue while trying to load a font file with the extension ".xnb" and I am receiving following error: Error loading "SpriteFont1". File not found. For ...
0
votes
1answer
209 views

What are the practical limitations of using XNA?

Since development on XNA has long since stopped, it is unlikely that it will ever be updated to be in line with modern graphics technology, however aside from the obvious fact that it's Windows-only - ...
0
votes
1answer
930 views

Xna c# picking model with Ray mouse cursor select the wrong model

i made a small 3D game and i just try to apply a basic sample from here : http://rbwhitaker.wikidot.com/picking for picking model by the mouse cursor. For that i use the Ray object and check if some ...
0
votes
1answer
378 views

Generate a random number of enemies to appear on screen

I am currently trying to create 2d shmups. I am trying to: Generate a random number of enemies to appear on screen Whatever number is generated will then be added to my List (the list is used to ...
1
vote
2answers
205 views

Drawing & transforming matrices upwards

I'm drawing a hierarchy of 3D objects in C# XNA where each objects has a transform that holds position, rotation and scale. I get my expected results If I draw my objects from my root node in this ...
1
vote
1answer
486 views

DirectXTK C++ : How do you use the Spritebatch.Draw() function with overloaded for RECT?

I am trying to make use of the DirectXTK's SpriteBatch for the C++ version on github. Which is heavily based on the one for XNA. However I can't seem to get the darned thing to work properly. I have ...
0
votes
1answer
52 views

Change color of a texture in a specific matrix location

I have following bool matrix: bool[,] centerPiece = new bool[,] { { false, true, false }, { true, true, true }, { false, true, false } }; Using a method, I put a ...
0
votes
2answers
51 views

Setting up a draw class giving exceptions

I'm currently trying to set up a class to draw tiles for me in different shapes, but it's currently giving me a hard time, as it's giving me nullreferenceobject errors in my secondary class. My Game ...
0
votes
1answer
52 views

Placing sprites properly to form an object

I'm working with XNA in Visual Studio, and I'm trying to draw this sprite: https://i.imgur.com/Dy5nSuG.png Only using this sprite: https://i.imgur.com/6T8TeTQ.png My current attempt relies on a ...
4
votes
1answer
949 views

XNA / MonoGame - render transparent background using stencil buffer problem (3d)

I'm trying to render 3d texture quads with the following properties: With lighting (rule out "AlphaTestEffect"). Transparent background (no opacity levels, just binary opaque or transparent). No ...
0
votes
1answer
336 views

What is more performance friendly?

I'm wondering what is more performance friendly: 1) Rendering a texture (in a seperate RenderTarget2D) and reuse it. (That will use multiple spriteBatch.End() / <...
3
votes
1answer
301 views

Using a single square sprite to create tetris-like objects

I'm currently working on a project in XNA, Visual Studio, where it is crucial I can create the classic tetris figures solely based on one square sprite (So I can return to each individual square at a ...
0
votes
1answer
51 views

how are the vertex properties of meshpart decided based on model format in xna

Exactly how the question says , how does the vertex properties like vertex stride and the data stored in the mesh part decided based on the format of a model and how would i determine that and then ...
2
votes
1answer
1k views

Find the closest point on a ray

I've got a ray defined by P1 and P2, and then a target P3, and I want to find P4. How do I go about this? I've come to understand that I should use vector projection, but I can't get it to work. Any ...

1 2
3
4 5
62