xna

Placing objects on scrolling background in XNA

How do I place objects that appear only if the background scrolls to a certain point? Example- I have this long image that keeps scrolling using the technique above. However, after scrolling to part of the image, I want to add a platform there. How would I do that? ...

Need help with Shallow Water Ripples effect in XNA

hello everyone. I need to create a water-like surface in XNA, viewed from above. Like this : http://www.youtube.com/watch?v=Nr42AG1aPAY Can someone point me to some examples? I don't know where to start. Thanks, SW. ...

Tile based collision in XNA

I have drawn tiles in my XNA game and loaded my character. My character, however, doesn't move- the map does, which gives it the illusion of movement. Now I am wondering how to actually test against them for collision. I mean, where does the collision code go and how do I make all tiles represent 'one big thing'? ...

How to include non-compiled content alongside a C# program published via Visual Studio

I'm trying to publish an XNA game through the Visual Studio Publish tool. The game uses some compiled and some non-compiled content. Basically, I have a level loaded in via XML serialization and a short video. These two files are essentially streamed in, so they aren't compiled. The publish tool includes the compiled content fine, but an...

How to handle many updating objects efficiently in C#?

I'm developing a 2D overhead shooter game using C# and XNA. I have a class that I'll call "bullet" and need to update many of these instances every fraction of a second. My first way to do this was to have a generic List of bullets and simply remove and add new bullets as needed. But in doing so the GC kicks in often and my game had som...

XNA GameComponent Implementation Preferences...?

I've recently jumped into the XNA pool, and am learning all the ins and outs of the framework in C#. One thing I've noticed in my research is that there seems to be no widely accepted "proper" way to implement GameComponents. After reading this thread (among others), I've discovered a broad spectrum of preferences among game developers...

Xna SpriteBatch Matrix.Decompose()

What I am looking to do is to be able to push and pop transform matrices into SpriteBatch. I have 2 sprites, parent and child, and the child should be scaled, rotated, translated relative to the parent. I currently have an implementation using textured quads but I think this should be possible using the built in SpriteBatch class and us...

XNA Rendering Issue

Hey guys, quite a confusing problem has struck me. After programming a fair bit of my game and it working correctly, i've come accross a model that won't show up in the level when i render it. I've tried scaling up, scaling down, rotating it, checking and double checking it's render matrix position and it just doesn't seem to render. I'v...

C# XNA: Optimizing Collision Detection?

I'm working on a simple demo for collision detection, which contains only a bunch of objects bouncing around in the window. (The goal is to see how many objects the game can handle at once without dropping frames.) There is gravity, so the objects are either moving or else colliding with a wall. The naive solution was O(n^2): foreach...

C# XNA Visual Studio: Difference between "release" and "debug" modes?

I'm working on a demo about collision detection. (Some of the code for this is detailed here.) In Debug mode, it works fine. In Release mode, it's faster, but the collision detection is REALLY messed up. Objects to bounce off nothing, or seem be oddly lightly effected by gravity. Some objects explode, as if they have collided with the sp...

Creating a shape using series of Vector2 - XNA

In my XNA game, I needed to define an irregular shape based on several Vector2 coordinates in the 2D space. The reason was to do collision check (like Rectangle.Intersects()). For example: Vector2 point1 = new Vector(20,30); Vector2 point2 = new Vector(60,30); Vector2 point3 = new Vector(60,80); Vector2 point4 = new Vector(40,90); Vect...

Does XNA have a Polygon, like Rectangle?

I'm making a game where there is only a certain space the player can move around. I want to represent this space with a polygon of some sort. The main question I would ask of it is whether it contains a given point. (Like rect.intersect()) Does XNA have any way to do this? ...

How to find transformation matrix aligning two lines?

Given two points in 3D space, A and B, I get a line segment LS. Given two new points A' and B' yielding the line segment LS', I need to find the transformation matrix that transforms LS into LS'. The length of the line segments is assumed to be equal. I have a theory on how to calculate the matrix, but I would really like some feedback ...

XAML Without WPF - Animations

Hi! I am trying to use XAML completely outside WPF, in particular inside an XNA application. So far, I have managed (quite easily, I am surprised to admit) to load some data inside my XNA application from a XAML file. The problems start when I decided that I wanted to animate one of the properties of my class...Nothing happens :( Here i...

Content Manager in another class XNA

I have created a separate class (let's call it class2.cs for example) and want to use it as a level, in that when I call it, it will draw everything in one level for me. I'm having trouble getting contentmanager to work in class2. In the given Game1.cs, you can easily just go texture2d= Content.Load<Texture2D>("photo"); but I can't in cl...

Game development with XNA or Unity3d

What can make a game developer to choose between XNA or Unity 3d as game development platform and what are the pros and cons of choose each one? ...

Increasing number once per mouse click/key press in XNA

This has been bothering me lately- when I use some code like below to increase selection every mouse click: if (m.LeftButton == ButtonState.Pressed) currentSelection++; Then currentSelection increases by a ton, simply because this code is in my Update() function and by design, runs every frame and so increases currentSelection. There is ...

Please help me decide how to figure out XNA's ContentPipeline

I have read this link : http://msdn.microsoft.com/en-us/library/bb464156.aspx They said : "... the XNA Framework Redistributable file does not contain the Content Pipeline Build Runtime. Building content at run time is supported only when XNA Game Studio has been installed on the Windows-based development computer." Actually, before ...

[C#] Reading input from secondary thread

Hi! I have an XNA application, and I need to redirect the input queue into a custom thread, instead of having it available only in the main thread. Is there an alternative to AttachThreadInput? ...

XNA networking on windows

What are XNA's builtin network functionalities? Is it possible to use XNA's builtin network in windows? If so, any restrictions? ...