Hey, I know this is an odd question, but I have asked on other forums and haven’t gotten much of a response. The game I am working on is actually in XNA, but seeing that the game I am wondering about is written in Java I was hoping someone might be able to help out a bit. I am trying to make a game that has a similar flying mechanic to ( http://www.terabytelabs.net/shyguys-cave-of-death/#comments). My problem is that when I release the spacebar the ship will continue to climb up for a bit before starting to descend…and overall it doesn’t seem to be nearly as snappy as the shyguy game.
If it would be any help here is my current code…again in C#
if (currentState.IsKeyDown(Keys.Space) == true)
{
sPos.Y += .4f;
velocity = 2;
}
if (currentState.IsKeyDown(Keys.Space) == false)
{
sPos.Y -= .8f;
velocity = -1;
}
}
public void Update(GameTime theGameTime)
{
KeyboardState aCurrentKeyboardState = Keyboard.GetState();
spritePosition.X = spritePosition.X + 5;
velocity -= acceleration * (float)theGameTime.ElapsedGameTime.TotalSeconds;
sPos.Y -= velocity * (float)theGameTime.ElapsedGameTime.TotalSeconds;
spritePosition.Y -= sPos.Y;
Movement(aCurrentKeyboardState);
}
Obviously I don’t expect to get a response written in C#…just a general idea about what I might be doing wrong.
Thanks for the help,
Troy