- by Hblade
Download
Alright, first thing's first. Set your background color to
- Red: 83
Green: 103
Blue: 146
- Screenshot
This is so we can actually see our character, and thus making it easier on our eyes Good, now that you have the art set downloaded, lets start First, make your player. You can see through him, but thats okay. Now that you made him, go to draw actor - put this code in.
- Code: Select all
if (yvelocity<4)
{
yvelocity+=.08;
}
This will limit his falling speed. Now that you have that add your Tile actor, and draw some tiles!
- Screenshot
Now add a collision, any physical response will do, no need for fancy stuff since your just learning how to do a velocity jump . Now that you added a collision effect, you need to make hum jump! For now lets do a single jump. make a variable called cjump
- Screenshot
- •Key Down
- Code: Select all
if (cjump == 0)
{
yvelocity = -9;
cjump = 1;
}
- •Z
•Script Editor
- Code: Select all
if (yvelocity>=1)
{
cjump = 1;
}
This means that when you start to actually fall, the character wont be able to jump in the middle of the air that way you can avoid issues such as you walk off the edge of a cliff and your still able to jump. Since our yvelocity is adding by .8 each time, its good to have it actually say if its greater thatn or equal to 1, that way it wont glitch and keep you unable to jump even if on the ground. This happens as a result of Draw Actor trying to constantly add .8 to the falling speed, which is making yvelocity spike from 0 to .8 and the physical response stops the character so you dont notice it.