Jumping

  • Thread starter OhMyEnglishTeaBags
  • Start date
O

OhMyEnglishTeaBags

Guest
Hello. I was wondering if any of you could help me out? I am trying to make it so that when A and W or D and W are pressed the player will jump diagonally. I currently use:

if keyboard_check(ord('A')) and keyboard_check(ord('W'))
{
direction = 135; speed = 60;
}
if keyboard_check(ord('D')) and keyboard_check(ord('W'))
{
direction = 45; speed = 60;
}

The only problem with this is that the player can hold the keys and just 'float' away. I tried using _pressed but then the jump is so small it's barely a jump. I also tried editing the speeds but that does not help (and I know the speed is being edited because when I press W on its own it jumps higher with a greater speed value). I also tried disabling gravity but that had no effect.

Any help? Thanks.
 

TesloStep

Member
you probably changing speed somewhere else in your player object code, so jump speed keeps only one step.
also, you need check to player be on ground to make jump - or they can infinity jump out of air.

there is good tutorial about platforming engine:
 
N

NizarPlayz

Guest
You can watch shaun spalding's Platformer Game part 1 tutorial he codes all the movement and jumping
 
Top