Zulbaric

 

Hello,

I am a C# begginer and i was just wondering if anyone could help me with a little problem. I have made a basic Spacewar game following a gamestate system. when the game load you press X and the game begins. you are meant to be able to fly a spaceship around but all i can get it to do is turn. i have some code which should fix the problem but i don't know where to insert it.

Vector3 modelPosition = Vector3.Zero;

float modelRotation = 0.0f;

//Position of the Camera in world space, for our view matrix

Vector3 cameraPosition = new Vector3(0.0f, 50.0f, 5000.0f);

//Aspect ratio to use for the projection matrix

float aspectRatio = 640.0f / 480.0f;

anythough on where the code goes or how to fix the problem would be much apreaciated

 



Re: XNA Game Studio Express Help needed with Spacewar Disaster

Jim Perry

Ummm, have you looked at the code in the Spacewar starter kit




Re: XNA Game Studio Express Help needed with Spacewar Disaster

Zulbaric

I've looked but cannot find the answer i need, any ideas on why the ship doesn't move



Re: XNA Game Studio Express Help needed with Spacewar Disaster

leclerc9

Well, you initialize your model velocity to the Zero vector, and only perform multiplication on the vector. Any number times a zero vector will result in a zero vector.




Re: XNA Game Studio Express Help needed with Spacewar Disaster

Zulbaric

Hi ive got another problem with the game. the skybox isn't working. Something with the cameras isnt working

the code is the same as above. Anyideas





Re: XNA Game Studio Express Help needed with Spacewar Disaster

leclerc9

Might I suggest splitting up your code such that you can test individual parts independently This can be especially helpful for beginners. For example, first set up your camera code and make sure it's always in the right place by making it view models for which you know the positions.

The first error I spotted was that you are scaling the camera's position in every frame by the TotalRealTime. This the time since the game began - you meant to use ElapsedGameTime instead, which is the time since the last call to update.




Re: XNA Game Studio Express Help needed with Spacewar Disaster

Zulbaric