Gravity
Firstly I applied gravity to the player by creating a verticle downwards accelration to it. This means if it is constantly accelerating down until it collides with another object (In my case the ground).Then I created a attribute called IsOnGround which allowed me to check if Player 1 is on the ground. This meant that Player one can only jump if he is on the ground. We did this by creating a rule to say that if player one is colliding with the ground (if it is true) he could jump.
We created the jump through a simple 'If space is pressed' Change velocity to 200 vertically. Meaning he moves up then slows down and gets pushed down by gravity
No comments:
Post a Comment