I was trying to make a platformer for my friend and teach him of how to make a platformer, but I just can’t find a way to disable jumping more than once.
Pretty self-explanatory.
I was trying to make a platformer for my friend and teach him of how to make a platformer, but I just can’t find a way to disable jumping more than once.
Pretty self-explanatory.
Salutations @pluto,
in regards to disabling more than 1 jump seems to be solved but the jumping still seemed inconsistent so i did a little tampering… hope you don’t mind
player.collide(ground);
player.collide(leftEdge);
player.collide(blocks);
if (keyWentDown("up") && player.velocityY == 0) {
player.velocityY = -6;
}
player.velocityY += 0.1;
i don’t know if this is a commonly unknown thing but… .collide() stops all velocity if it’s colliding against the correct object… by doing this we hit 0, then we look for that in the jump code… then continue applying gravity it seems a bit better now with that in the movement function
Best of luck on getting a platformer out!
It still doesn’t work.
Well… did you remove the other collisions from the draw() loop… you should also probably do that sorry if i didn’t make that obvious
if your still unsure about what is wrong use this Link: https://studio.code.org/projects/gamelab/PAk6X-9t5Yfbh6SX0IciWDa3hpSA8ASh-knWwgsP-Y0/view it was what i did originally to get your game running before
Alright, thanks for helping!