In this case jump is a variable created to store a true/false (1/0) value, representing whether or not you can jump.
- Code: Select all
if (jump == 1)
this is an "if" statement - a type of conditional. In this case, the condition is "jump == 1". The "==" makes a comparison, so it will return true if both values (jump and 1) are equal.
After this there is a code block, which is surreounded by { } This is what should be done if the condition (jump == 1) returned true.
- Code: Select all
yvelocity = -20;
This sets the event actor's (the actor the event is on) velocity on the y-axis to -20; that is, moving upwards at twenty pixels per frame.
- Code: Select all
jump = 0
This sets jump back to zero, so that next time the event occurs, the condition at the start will return false, so we can't keep jumping indefinately. We must wait for some other action (presumably a collision with the ground) to set jump back to 1.