1
Answer

Running game C# visual studio windows form

Alvin Eka

Alvin Eka

7y
254
1
i am currently making a running game for my college assingment using c# with visual studio 2011, currently i managed to make my character jump but i need to make it jump more than once can someone help me with the code?i would appreciate any kind of help
thanks  
 
this is my code for making my player jump
 
in FormKeyDown
 
if (jump == false)
{
if (e.KeyCode == Keys.Space)
{
jump = true;
force = gravity;
}
}
 
in timer
 
if(jump)
{
player.Top -= force;
force--;
}
if(player.Top + player.Height >= screen.Height)
{
player.Top = screen.Height - player.Height;
jump = false;
}
else
{
player.Top += 1;
}
 
Answers (1)