new jump method
This commit is contained in:
parent
73cb60941d
commit
40e00559c6
19
program.pde
19
program.pde
@ -2,6 +2,8 @@
|
||||
//- Start Screen
|
||||
//- Level Editor (click with mouse spawns or deletes tiles)
|
||||
// - Hotkey to slide the window right and left
|
||||
//- Movement berechnen mit move = gravitation - speed
|
||||
// - Jump als Zahl, die langsam kleiner wird
|
||||
|
||||
// jumping related
|
||||
float speed = 20;
|
||||
@ -138,12 +140,17 @@ void jumpToJumpheight() {
|
||||
jumpheight = 0;
|
||||
}
|
||||
}
|
||||
// count down jumping cooldown
|
||||
void cooldown() {
|
||||
if (jumpcooldown > 0) {
|
||||
jumpcooldown = jumpcooldown-1;
|
||||
|
||||
float movement;
|
||||
float jumpspeed;
|
||||
void newJump() {
|
||||
movement = gravitation - jumpspeed;
|
||||
pos.set(pos.x, pos.y + movement);
|
||||
if (jumpspeed > 0) {
|
||||
jumpspeed--;
|
||||
}
|
||||
}
|
||||
|
||||
// actions for moving
|
||||
void keyPressed() {
|
||||
if (key == CODED)
|
||||
@ -160,10 +167,10 @@ void keyPressed() {
|
||||
pos.x = pos.x + direction.x * speed;
|
||||
//}
|
||||
}
|
||||
if (keyCode == UP && jumpcooldown == 0)
|
||||
if (keyCode == UP)
|
||||
{
|
||||
//if (directionY<0) {
|
||||
jumpheight += 400;
|
||||
jumpspeed =+ 25;
|
||||
//}
|
||||
}
|
||||
// else if (keyCode == DOWN)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user