Jumping already is easy:
<when green flag clicked>
<forever>
<if><touching[ platform]
<set{ yVelocity }to(1)
<if><key[ up arrow ]pressed?>
<set{ yVelocity }to(15)
<end>
<end>
<change y by( <{ yVelocity }>
<change{ yVelocity }by(-1)
<end>
Offline
demosthenes wrote:
Jumping already is easy:
<when green flag clicked>
<forever>
<if><touching[ platform]
<set{ yVelocity }to(1)
<if><key[ up arrow ]pressed?>
<set{ yVelocity }to(15)
<end>
<end>
<change y by( <{ yVelocity }>
<change{ yVelocity }by(-1)
<end>
there are other ways to do this, but to the same effect.
Offline
726961 wrote:
demosthenes wrote:
Jumping already is easy:
<when green flag clicked>
<forever>
<if><touching[ platform]
<set{ yVelocity }to(1)
<if><key[ up arrow ]pressed?>
<set{ yVelocity }to(15)
<end>
<end>
<change y by( <{ yVelocity }>
<change{ yVelocity }by(-1)
<end>there are other ways to do this, but to the same effect.
That is the best and simplest way though.
Offline
archmage wrote:
726961 wrote:
demosthenes wrote:
Jumping already is easy:
<when green flag clicked>
<forever>
<if><touching[ platform]
<set{ yVelocity }to(1)
<if><key[ up arrow ]pressed?>
<set{ yVelocity }to(15)
<end>
<end>
<change y by( <{ yVelocity }>
<change{ yVelocity }by(-1)
<end>there are other ways to do this, but to the same effect.
That is the best and simplest way though.
I know, I am just saying that there is multiple ways to get a product close to what this achieves.
Offline
bryano wrote:
Using this method the sprite flickers a lot because if you are not pressing the up key y is always being changed by yVelocity and yVelocity is always being changed by -1, how can we get around that?
by using more if statements...
Offline