CHANNELS:

All
g
gmdisnuts posted 2 years ago
g
gmdisnuts posted 2 years ago

I'm still pretty new at this but I think I'm getting close?

if (keys.up.pressed = true && player.position <= platform({      })  ) {    player.velocity.y -= 25   }

0
g
gmdisnuts posted 2 years ago
case 38:      console.log('up')          if (allowJump) {        allowJump = false;                player.velocity.y -= 25                setTimeout(function(){           allowJump = true;        },500);                break           }

This did solve my issue for the time being. Probably some sort of collision detection would be better. Still new at this but this does get the job done for the time being.

EDIT: let allowJump = true;

put that above addEventListener I'm sure there's a much better way to do this but it worked.

0

Want to participate?

Create a free Chris Courses account to begin

or
Sign In

Providing the lift to launch your development career

© 2024 Chris Courses. All rights reserved.