XNA Game Studio 4.0 is a programming environment that allows you to use Visual Studio to create games for Windows Phone, the Xbox 360 console, and Windows-based computers.

learn more… | top users | synonyms (1)

1
vote
1answer
57 views

Can I rely on SoundEffects being stopped when unloaded?

I am using XNA's SoundEffect class to play sounds. I have to unload all sounds from the corresponding ContentManager for technical reasons, while some of them are still playing. What happens to ...
0
votes
0answers
90 views

Smooth circular collisions with edges/collision boxes [C# + XNA]

So, me and a friend are working on our top-down perspective 2D game, and have come to work on perfecting our collisions. In its current state our player sprite is colliding with walls, but is ...
1
vote
2answers
167 views

XNA blurring moving images

Why does XNA blurs the images which moves less than 1px in between two draws? It is quite annoying, because everything looks really blurry. Is there a way to disable it? I have tried to set the ...
1
vote
1answer
142 views

Angular velocity from 2D Collision

I have been working on a 2D physics engine for my A Level computing project and I am having trouble calculating the angular velocity from a collision. I have managed to workout each objects linear ...
0
votes
0answers
79 views

Collision - Per Pixel and Rectangle Based, Combined

UPDATE:i found the error in my calculation the problem was that i needed to consider if the image is rendered flip or not to fix it just need to rub from the opposite side of the sprite I am currently ...
0
votes
0answers
27 views

Farseer Physics, mass affecting velocity

I have just started with Farseer Physics, so I am kind of a newbie in this theme, so not a surprise that I have encountered something that is not involved by the engine, or I just don't know about it. ...
0
votes
1answer
54 views

xna 2.5d gravity system

i currently developing a game using the xna API. now the game i am developing is 2.5d. by 2.5d i mean the character or object can move left and right and a up and down(not just by jumping) that it ...
0
votes
1answer
162 views

How can I create my own GameTime for timing things in my game?

I have a Game class and a GameComponent class. I want to perform operations inside the GameComponent class which depend on calling gameTime.ElapsedGameTime.TotalSeconds, but I've noticed that that ...
2
votes
1answer
95 views

map the section of a procedurally generated surface on a plane

I'll try to be as clearer as I can. I have a surface on a 3D space which is not flat, it has hills and depths. My goal would be intersect it with a plane so that I can map the section of the surface ...
1
vote
0answers
93 views

Using obj file in an XNA game [closed]

Sorry if this is a bit novice but I am far more into engineering than game development but I just want to make a small 3D game for fun with XNA (well actually MonoGame). The thing is that I don't have ...
0
votes
1answer
65 views

Height map renders upside down and/or backwards

After following the tutorial found here:http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series1/VertexBuffer_and_IndexBuffer.php The code at the bottom of this page is what I am using. (I have ...
1
vote
2answers
97 views

margin of error trying to check if a point lays on line

Working with floating point values it is as easy as breathing to run on approximation errors by comparing quantities which should be the same. I want to know if there is a way built in some MSDN (or ...
5
votes
1answer
277 views

How can I draw a perspective-correct quad?

I'm trying to draw a quad in 2D (in SharpDX, but that is basically XNA). But texture correction is not working, and I'm getting only an affine textured quad. I'm using BasicEffect to render it. ...
1
vote
2answers
99 views

Where does the Game class come from in the DrawableGameComponent constructor?

I'm making a project to Windows Phone using Silverlight + XNA, but I don't know how I can use the DrawableGameComponent because the constructor requires a Game class, it looks like this: Planet.cs ...
0
votes
3answers
142 views

Why I am I told “Color0 is missing” when I run the following code?

In the code below, I want to draw a box on my screen. But when I run it, there is an error message: The current vertex declaration does not include all the elements required by the current ...
-1
votes
1answer
78 views

Why doesn't my XNA model render at all? [closed]

I am trying to draw a 3D Model in XNA 4.0, but it doesn't show up. I think I made it correctly, but maybe not. My code follows: Here is the LoadContent and Draw method of my Main class. Spaceship is ...
2
votes
1answer
107 views

How do I check if a surface is sloping?

I'm implementing gravity over a 3D terrain and I'm struggling with how to check if surface "under your feet" is flat or sloping. I read some tutorials but gravity is always considered along a single ...
0
votes
2answers
292 views

Add a “fake” Loading Screen

I'm working on a 2D game for WPF8 using XNA 4.0. Everything goes great, but it's too fast. I was just wondering, what could I do between the end of the game and the score screen, and before the game ...
0
votes
1answer
117 views

Where does XNA 4.0 takes memory from to perform operations?

I found this question which talks around the question I'm interested in. In particular I focused on the line where the guys says that GraphicsDevice object is literally a representation of the ...
0
votes
1answer
89 views

XNA DepthBias increases performance even when EarlyZ is turned off. Why?

My 3d scene consists of three main polygons: The first and the second polygons overlap each other (have the same World matrix and use the same geometry), the third one is perpendicular to the first ...
6
votes
1answer
155 views

How should I attenuate sound in a 2D game where you can zoom in and out?

In my 2D game, I have some ambient sounds like the noise of a waterfall or the humming of a generator. However, it is not practical to play these sound all the time at full volume as in a large level ...
0
votes
0answers
28 views

Skip the first RenderTarget when writing to MRT with Opaque blending

I am writing to three rendertargets and whant to know how to tell a GPU not to write to the first RT. When you write a shader you can simply output less data than you have RTs (like output a single ...
0
votes
1answer
274 views

Rope Colliding with a Rectangle

I have my rope, and I have my rectangles. The rope is similar to the implementation found here: http://nehe.gamedev.net/tutorial/rope_physics/17006/ Now, I want to make the rope properly collide ...
1
vote
1answer
274 views

Get screen bounds of 3D object

I'm trying to draw a 2D plane that has minimum dimensions to contain a 3D model (a sphere). How do I calculate the minimum size and position of the rectangle to completely cover a 3D model on screen?
8
votes
2answers
515 views

What are some ways to texture map a terrain?

I'm working with XNA on a 3D Game, and I'm trying to have a proper and nice environnement. I actually followed a tutorial to create a terrain from a heightmap. To texture it, I just apply a grass ...
0
votes
0answers
84 views

Avoiding lag when rendering Texture2D for first time

I have found a similar question here, but it is about playing sounds. I am using 2048 x 2048 textures for sprite sheets and every time I call spriteBatch.Draw using a sheet for the first time in game ...
2
votes
1answer
113 views

What's the difference between Textures and VertexTextures in XNA?

The GraphicsDevice class of XNA has the properties Textures and VertexTextures. What is the exact difference? I don't really understand what MSDN tells me about this. I usually use Effect parameters ...
0
votes
1answer
169 views

Obtain rectangle indicating 2D world space camera can see

I have a 2D tile based game in XNA, with a moveable camera that can scroll around and zoom. I'm trying to obtain a rectangle which indicates the area, in world space, that my camera is looking at, so ...
4
votes
4answers
434 views

The physics equation for a perpetual seesaw

I am trying to create a game that involves two or more people jumping on a seesaw and propelling each other in the air. I need help with the physics equations Assume no friction and no air ...
0
votes
1answer
117 views

Changing enum in a different class for screen

I'm trying to make a start menu for my game and my code uses Enum's to moniter the screen state. Now i want to change the screenstate declared in the main class, in my Background class Screen screen ...
-1
votes
1answer
788 views

How do I make a health bar that drains when the player takes damage? C#/XNA

I've drawn a Health Bar before and had it drain/refill on a button press using if statements and rectangles. First I loaded the image, then I set a new rectangle to be equal to the image's height and ...
1
vote
1answer
239 views

XNA - Where should I start playing a song?

I am just wondering where is the best place to start playing the background song for a game. In the loadContent() method, Draw(), or Update() methods or when I initialize it? I am trying to make it ...
0
votes
2answers
170 views

Collide with rotation of the object

I'm developing a mirror for lazer beam(Ball sprite). There I'm trying to redirect the laze beam according to the ration degree of the mirror(Rectangle). How can I collide the ball to the correct angle ...
0
votes
1answer
80 views

Why am I getting a return value of zero from my position computation function?

Ok I have a Function int x(), which is used in new Rectangle(x(),a,a,a); in DrawMethod in XNA but when I use it I get x() = 0 as as the answer.Here is my CODE: int x() { int px ...
1
vote
1answer
481 views

Parallax scrolling with 2D camera [duplicate]

I'm developing a 2D Platform game, I have a 2D camera, some backgrounds, and everything is working good. Now I want to implement parallax scrolling to give the illusion of depth in my game, but i ...
0
votes
1answer
250 views

XNA Arcball and moving model - the model is altered instead of the camera

I'm trying to implement an arcball type camera, I've got all controls working very nicely. I can rotate the X/Y axis with my mouse and zoom in and out with the Z/X keys. The problem is, that the ...
0
votes
0answers
428 views

XNA 4.0 - stretch full screen window?

I have an issue with resolution in XNA 4.0. I'm running fullscreen. The game runs standard at 1920x1080, and can be scaled down to 1280x720. The resolutions are both 16:9 (1920/1,5 = 1280, 1080/1,5 ...
2
votes
1answer
302 views

Resize texture in code

I need to change texture size from for example 800x600 to 80x60. I have two ideas of how to do that, but i have problems with both approaches. 1) changre render target then draw and save resized. the ...
0
votes
1answer
210 views

render sprites with a transparent background (XNA)

For my game I want to make a map of the world. Per country I made a file with the border of the country and the rest of background is transparent. This way all my files have the same width and height. ...
0
votes
1answer
67 views

How can I animate the stretching of a sprite over time?

My goal is to find the function to stretch a sprite like my example below, and then get it to animate during a certain time. It is like an interpolation, where the starting point is the original ...
1
vote
1answer
114 views

What does Rectangle.Intersect means/do?

Ok I have two rectangles one is the ball and other is the paddle. 1. if(ball.rectangle.intersects(paddle.rectangle)) y = -Math.Abs(y); and 2. ...
2
votes
1answer
478 views

How to use elapsed game time for timing

I want that my ship shoots beam after every 2 seconds. How do I make that happen? and also I want that after 50 shots I want to give 10 seconds to reload the gun. I know both of my problems can be ...
1
vote
1answer
60 views

Shared Texture2D in XNA

I am trying to define texture2d objects as shared. The reason of why I am trying to do is, I made an xna user control and my project loads unlimited (as much as the user wants) my XNA User Control. ...
0
votes
1answer
149 views

Texture2D can't find my sprite - how to setup the content directory in XNA

So I keep getting told that spr_lives can't be found. I'm working out of a book and using the samples given to me (have not changed the code or folder structure, so it /should/ work) but nothing's ...
2
votes
0answers
220 views

Monogame working with Krypton

I am trying to make a simple 2D game engine using Monogame and the Krypton 2.0 lighting engine. So far I have succeeded in rendering a light but I am unable to generate any shadows from any hull's. ...
0
votes
1answer
145 views

Mouse input not updating in custom XNA/Winforms panel

I have a custom Panel residing within my WinForm. the custom Panel holds the XNA rendering. So far, I've rendered an 3D test model. What I'm doing now is trying to handle the input.Using a camera from ...
0
votes
1answer
194 views

Collision Issues

When I run the collision code, there are no errors, but when I shoot the enemy nothing happens..... Any problems that are blindingly obvious? Class Level Variables public Model model { get; ...
0
votes
1answer
175 views

First person shooter camera movement

I am making an FPS in XNA. I cannot seem to make a FPS camera that I can move Forward, Back, Side to Side using the keyboard. How do I do that?
2
votes
1answer
80 views

What is the best way to follow this book using XNA 4.0 instead of XNA 2.0

I found a reference to this book on the Microsofot Indie games forums: http://www.amazon.com/dp/1430209798/ref=pe_385040_30332200_pe_309540_26725410_item I'm really interested in it, because the ...
0
votes
1answer
284 views

C# XNA4 2D Collision Detection

I am working on a 2D engine in Xna and am running in a bit of trouble with Collision implementation. What I want to do is have an interface ICollidable that I can add to GameObjects that are ...