I'm making a racing game as you may know, and I need a way to scroll the car around the track. I want the car to stay in the center of the screen at all times. Any suggestions?
You could just have the sprite stay stationary, and then draw it right in the middle of the screen and do your rotations and things to that sprite. Then, you could move the background in the opposite direction you want the sprite to 'move.' For example, if you want to drive up, you move the background down to give it that appearance.
Above is the more simple method, but it's not as powerful, and can be difficult to add features to (but for just a simple racing game it works).
The method that you'll probably want to use is that of a camera. Now, I'm not sure if cameras work with the zune, but I don't see why they wouldn't, as long as you don't use any 3D stuff. You would keep the camera focused on your car (it would move as your car moves), and then it should work how you want it to. This method is better if you plan on adding other racers (AI) and objects to the track.
In this case your "camera" is just a rect, every frame update the camera's rect to be centered on the center of your car. Then you just draw anything that's inside the rect. I believe XNA is good enough so that your pixel position is just the item's position minus the camera's position. Doing it such that your car is stationary and everything else moves around it is fine if you're moving in a certain direction, but once things are turning it gets really confusing
I seem to have a working camera method, though when everything deploys and the game is about to start, this message pops up: An unhandled exception of type 'System.NullReferenceException' occurred in RacingGameStarter.exe
The line that is highlighted: Camera.Update(gameTime, carPosition);
I'm having a little trouble incorporating my camera system into the game. What I have now is:
//STEERING
if(GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.DPadLeft))
{
carRotation -= (float)( 1*3f * gameTime.ElapsedGameTime.TotalSeconds);