Hello, I'm new to the Scratch community, but not to scripting.
This is a rather advanced question to some of the communities more experienced users.
I'm just wondering if theres a property that you can give to certain scripts that makes sure that you can't activate any other scripts while you're using said script?
Lemme explain. I'm making a platforming game with Scratch, and I'm working on the moving physics of it. When you press left and right, you move and that direction with a chain of walking sprites. When you press up, you're Y position goes up, along with a chain of jumping sprites. However, if you press left or right during this jumping sequence, you walk in air. xD
Anyways, I'd like to know if you could, perhaps, disable walking while jumping?
Offline
Yes, simply make a variable called jump. When you jump set the variable to 1, and when you are not jumping set it to 0. Then make it so that you can only move left and right if jump? is 0. If I have not made myself clear, use this script:
[blocks]
<when[ up arrow ]key pressed>
<set{ jump? }to( 1
<repeat( 10
<change y by( 4
<end>
<repeat( 10
<change y by( -4
<end>
<set{ jump? }to( 0
[/blocks]
And use this one for left and right:
[blocks]
<when green flag clicked>
<forever if><< <key[ right/left arrow ]pressed?> <and> <( <{ jump? }> <=> 0 )> >>
<change x by( 4/-4
[/blocks]
I hope I made myself clear.
Offline