A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

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
2
votes
1answer
545 views

Having trouble creating multiple sprites from one class

So I am trying to make more than one sprite using a single class but I cannot seem to get the sprites to be drawn at all or drawn in different places (they are all just on top of one another). In my ...
0
votes
1answer
450 views

Using XNA to create an isometric tileset?

In XNA, how can I take any given texture, then render it so that it fits completely into a 64x31 (or 32x15) isometric tile such that it tessellates perfectly? My goal is to give various textures to my ...
0
votes
1answer
529 views

Draw a Texture to fit a rectangle

I would like to draw a texture in a rectangle that is smaller than the texture, normally the texture will be scaled to fill the rectangle, which results in a squished image. I want to draw it to fit. ...
2
votes
1answer
115 views

Ray casting fails when it shouldn't

I have two objects that should collide. My player should stand on a ship. The position where my player stands, is exactly on the edge of two adjacent triangles (in the ship's model). To Check for ...
0
votes
1answer
377 views

Transform matrix hierarchy issue

I'm trying to implement a parent child relationship between Sprites and draw them to the screen. I'm calculating transforms by chaining transform matrices. I'm using code from here: ...
0
votes
2answers
674 views

Using sourceRect or cropping out a Texture 2D to draw? MonoGame/XNA

I was wondering what is the best way to draw textures (for performance). Using the sourceRectange in the spriteBatch.Draw() call and just draw the whole spriteSheet, or crop out every texture on the ...
3
votes
2answers
882 views

2D Platformer AABB collision issues

Before anyone say that this questions already has a answer, I will list all the questions I read and tried: AABB collision resolution issues Trouble with AABB collision response and physics https://...
5
votes
1answer
650 views

How to do Chromatic Aberration on a transparent background?

I have a problem with a chromatic aberration shader effect... If I produce the effect on a white background I get exactly what I want: But if I do the same effect on a transparent background I get ...
5
votes
1answer
147 views

transfer 3d model processing from Xna to Android?

I developed an XNA scenario in a desktop application and I need to make the same scenario in an Android app so I need to process data on the desktop computer and just display it in Android app using ...
-1
votes
1answer
148 views

Bullet only removing closest enemy

I'm having an issue with my collision detection code. I'm making a top down shooter and when I shoot, the bullet will only destroy an enemy if it's the closest enemy. The bullet will go right through ...
1
vote
1answer
171 views

Check collision with rectangle and pixels

I have done a function to check the pixels collision against two animated sprites, and now I need to check a "Rectangle x animated sprite" collision, but I have no ...
0
votes
1answer
490 views

Mode 7 in xna/monogame

I want achieve a view like Mode 7 from snes games where the closer textures get stretched out more and more far away textures look smaller. Something like this: What I have in my project at the ...
2
votes
1answer
362 views

How to fix my camera collision, C# XNA

I am having some weird issues with my camera. I am trying to make it so it is a first person camera, that when the user presses the W or Up key, it moves towards where the camera is looking. My issue ...
0
votes
2answers
188 views

Is it possible to trigger a loop with key input

Ok I need to know if it is possible to trigger a gameloop with a key press? ex code ...
0
votes
2answers
509 views

XNA's GameTime.ElapsedGameTime.TotalSeconds isn't working as expected

As I've seen at quite a few website, the best way to handle variable frame rate and movement (moving projectiles, monsters, swinging swords)... looks something like this: ...
1
vote
1answer
625 views

How do I make 2 players from one Class?

I am teaching myself XNA and only started a few days ago. I am making a clone of Pong and have made a class for the Paddle: I am wondering how I can create 2 paddles one for each player from the one ...
0
votes
2answers
283 views

Best way to draw 2D shapes on a 3D flat object

I want to draw shapes (arcs, circles, lines) on a table, which is in 3D space. The table top is at Y=0 level and oriented so it points to (0, 1, 0). There are some other 3D objects on the table, so ...
1
vote
1answer
132 views

Why my game is running slowly if it was launched from a wpf application?

i have some issues why my GameEditor. I would start my XNA project from it, like a debug-client. It opens and all works fine, but it runs on 45 frames until I hide the wpf form. then the framerate ...
0
votes
2answers
489 views

Calculate ticks for animation delay

Hi guys I am trying to calculate the correct elapsedTime for each frame in my animation. Example I have a sprite called stance that has 20 frames I want to give each frame a tick delay property that ...
0
votes
4answers
180 views

using loop to detect collision in XNA

Got a problem, with collision detection, I need to detect collision between bullets and meteors using nested loop for this, but it isn't working. ...
1
vote
1answer
281 views

Relation between game systems and components in a component-based architecture?

Based on a question I previously asked here regarding to decoupling input from other components of an entity I developed a small component architecture on top of XNA to understand how everything works ...
0
votes
1answer
147 views

Multitexturing depending on given variables?

I'm having trouble with rendering multiple textures. Using XNA gamestudio: working with 3D meshes and texturing. Effect.fx HLSL I do have a map/level that loads from a heightmap. - This works I have ...
-1
votes
1answer
163 views

XNA collision detection between Lists

I have 2 lists, one is for meteors and second is for bullets. I have problem with collision detection between them, this is my code for meteor spawning: ...
2
votes
2answers
374 views

XNA makes the console flicker

I create a Window XNA game project from the template in Visual studio 2015. Then I right click and set the property to console application because I think it is convinient to use Console.WriteLine() ...
1
vote
0answers
1k views

How to use OpenTK (OpenGL) with MonoGame?

So I've been making a snake game using MonoGame (DirectX Only). I added movement, controls, feeding and growing in length. I wanted to add smooth animations to the game because the snake is just made ...
1
vote
1answer
154 views

HLSL pixel inside a view (cascaded shadowmapping)

I'm figuring out shadowmapping in HLSL (see also this question). I understand that I need projection matrices for each cascading shadowmap. I use this code to create the projections: ...
1
vote
1answer
4k views

MonoGame does not generate xnb from png

I am coming straight from XNA and I installed the latest version of MonoGame today (2015-12-22) for Visual Studio 2015 Community. I created a project from the windows Project template. I right click ...
0
votes
1answer
58 views

XNA Texture2D Copy Error

I have a static class that I use to build a 3d character and render the results to a RenderTarget2D which I then return. I'd like to store the results for later use so I need to make a copy of the ...
1
vote
1answer
824 views

HLSL Shadowmap shader for large scale environments

I'm working on a racing game in Monogame. The game runs fine so far using Monogame's BasicEffect (link to video). I wanted to add shadows so I implemented a shadowmap using this as a base. and a ...
0
votes
1answer
40 views

XNA 2 3D Objects Depth Convergence Error

Gah! I have a scene with 2 3D objects - a plane and a sphere; the plane sits on the xy axis with a depth if -100 and diameter of 200; the sphere diameter is 32 and sits on the xyz = 0 position; ...
4
votes
0answers
121 views

XNA Shader working different on different PC's

I am working on a game in C#/XNA which uses custom shaders for drawing. When the code is compiled on my machine it works perfectly on all computers I tested, but when my team member tries to compile ...
0
votes
1answer
717 views

In Monogame, why does Rectangle.Offset not work?

I have the following code in a default Monogame Game project: ...
2
votes
1answer
429 views

XNA Advanced font rendering (outline, shadows, etc) [closed]

I am looking for a tool that will output spritefonts for XNA consumption that have an outline effect. I know that this can be done by rendering the text multiple times, but I'd like to take care of it ...
2
votes
3answers
259 views

In XNA, how do I get forms to display in front of my full-screen game?

I'm trying to open a form in front of my game, which is full-screen. However, the form seems to appear only behind the game window. At the moment, I'm doing this: ...
3
votes
1answer
95 views

Optimizing my 3D XNA game

I've come to a point where optimizing my game is very much needed.My update() routine takes 0-2ms. My draw() routine takes about 100ms when drawing 3.5M triangles (Not the amount I really have to draw,...
1
vote
3answers
4k views

How to restart the game when pressed enter in XNA

If the following code allows the game to exit when pressed esc .. ...
6
votes
2answers
1k views

2D A* Path-Finding

I have this problem, which isn't really a problem, but I feel like it's some sort of glitch in my code maybe. My pathfinder, to find a path from A to B, does this: which is almost fine, it works ...
2
votes
1answer
439 views

How to link the game class to the main menu class in XNA?

So I got my game in another class and my main menu in another class. This is the update method in my Main menu class ...
0
votes
1answer
433 views

Updating score in collision detection game in XNA

I created a collision detection game in XNA but I have a problem with the scoring. As online tutorials says, I initialised it score = 0; This is in the update ...
0
votes
2answers
828 views

How to draw the elements that are in a Texture2D list in XNA

I have a Texture2D list called blockTexture that has 2 elements in it. I use the following line to draw the first element. ...
3
votes
1answer
303 views

XNA/Monogame Change SpriteBatch Blendstate in between calls

I'm working on polishing up the particle system in the project I'm working on in Monogame. Currently particles and objects are all drawn within the same Begin/End block to allow for FrontToBack depth ...
2
votes
1answer
434 views

Calculating rotation matrix for an object relative to a planets surface in MonoGame

I have a 3D planet and I would like to place models on the planet and have them start with a base rotation relative to the planet surface at their location. So a model at the north pole will have zero ...
2
votes
1answer
184 views

How to change XNA coordinates directions?

Usually XNA increases X coordinate to right and Y to down. Like this: But in my project i have 2D map. Drawing tile with bigger Y coodinate below OX looking strange (usually people imagines these ...
2
votes
1answer
81 views

Can I use a BlendState object to emulate a draw call's blending color?

I'm working on a lighting system for a tile-based game. What I want to do is draw my tiles to the screen, then draw a single Texture2D object (my light map) over top of them. However, doing it in ...
1
vote
0answers
482 views

Drawing objects in view of camera only in XNA/MonoGame

I am working on a Tower defense style game on mobile that uses a tile map and I am trying to determine the best way to draw overlays of those tiles. In my game, I go into build mode to build towers. ...
2
votes
1answer
1k views

How can I save an XNA texture as a PNG file?

I have a Color[,] variable and I already know how to convert it to a Texture2D. How do I then save it as ...
1
vote
1answer
102 views

Rotation Continuity help

First the issue im having: Basically its the fact that the angles of a circle aren't continuous, they rise from 0 to 2pi then immediately fall back to 0. I want to make a game where the player ...
1
vote
0answers
120 views

How to create offsetting lines that draw across the screen in Monogame?

I'm trying to create an effect on the screen like the gif below. Basically lines that are offset by 1 pixel draw across the screen from either side which then eventually creates a solid color. I'm ...
3
votes
3answers
3k views

How to create a delay/timer and fire an action once it expires in C# Monogame? [duplicate]

First off I'm somewhat new to C# but I'm working on a game in C# Monogame and I'm trying to get timers working. There was a similar question answered around here a while back but I found that the ...
3
votes
1answer
179 views

Effective AI for 3D Motion

I am developing a game in XNA and am trying to create an effective AI for the enemy and friendly spaceships but am having a hard time keeping the game effective without disadvantaging one side or the ...