Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I ran through the first training on XNA where you make a shooter game. They did some thing that I would not do and I want to use their starting point to learn more things.

I want to try better collision and adding a menu. I saw something online with the sonic physics where they have a frame by frame of sonic moving 1 pixel. See picture below.

I am new to development, but I have been programming for years now. What would you guys suggest to try these different things out.

How would I simulate a similar frame by frame testing as they do in the above picture?


share|improve this question
Do you want to implement collision boxes that are independent of the boundaries of the texture? – Emir Lima Apr 12 '12 at 14:17
I don't know much about it currently, I am using the rectangle collision and I want to move to something that i more pixel accurate. My big thing with there tutorial is that the box they use once you add the animation is throws off the movable area of the screen, I was hoping to pinpoint what was causing that. – kwelch Apr 12 '12 at 14:22
up vote 0 down vote accepted

What you need is another rectangle that represents the "contact body" of the sprite, different from the rectangle that represent the drawing surface of the sprite. It's the principles of the bounding boxes.

In my 2D fighting game, for example, I have one different bounding box per keyframe of the animations.

share|improve this answer
Where should I put the code for that? In the draw of player/enemy? – kwelch Apr 12 '12 at 18:56
The hit test goes to this another rectangle. And the rectangle that contains the boundaries of the whole sprite is used only for the drawing. – Emir Lima Apr 13 '12 at 11:29
I will try this out thanks! – kwelch Apr 13 '12 at 13:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.