I have been watching Pygame tutorials to learn the module, and it came to the portion where the instructor shows you how to make your character jump. However, I am finding it impossible to understand the code they put down, and they did not explain it very well.
Can anyone break down for me the code below so I understand exactly what is happening? And is there a simpler way of coding a jump for a character? Please keep in mind I already have the code set up to where pressing the spacebar makes this code activate.
Isjump = False
Jumpcount = 10
#code for spacebar activation here, turns Isjump to True#
if Jumpcount >= -10:
Neg = 1
if Jumpcount < 0:
Neg = -1
y -= (Jumpcount ** 2) * 0.5 * Neg
Jumpcount -= 1
else:
Isjump = False
Jumpcount = 10