I'm tryin to get the last 'if' statement to work but he either moves or jumps. How do I get it to work? example:
[blocks]<when green flag clicked>
<forever>
<if>
<key[ up arrow ]pressed?>
jump
<else>
<if>
<key[ right arrow ]pressed?>
move right
<else>
<if>
<key[ << up arrow <and> right arrow >> ]pressed?>
front flip[/blocks]
Offline
Hi, fireballman!
Have you tried using the motion blocks? Maybe split your scripts up, too, that usually helps to show where things go wrong, and it makes things run faster Like so:
[blocks]
<when green flag clicked>
<forever>
<if><key[ up arrow ]pressed?>
<change y by( INSERT A NUMBER
<if><key[ right arrow ]pressed?>
<turn cw( INSERT A NUMBER )degrees>
<else>
<if><key[ right arrow ]pressed?>
<change x by( INSERT A NUMBER
[/blocks]
Hope this helps
Offline
Noooo I don't think you understand because of my terrible explanation. I got him to move using the motion blocks and jump using some kind of sin of sine script, but he doesn't front flip when you push right arrow AND up arrow. I have seperate front flip costumes that he is meant to switch to when you push up and right keys but he doesn't seem to switch to them.
Is it because the up and right arrow keys already make him do something different?
Offline
The way your script runs is as follows:
1) If the up arrow is pressed, he moves up.
2) If not, he sees if the right arrow is pressed, and it so, he moves right.
You see, he only checks for right/left IF the up arrow is NOT pressed.
A better way, in this case, would be:
<when green flag clicked>
<forever>
|<if><key[ up ]pressed?>
||Code to be executed if up key is pressed
|<end>
|<if><key[ left ]pressed?>
||Code to be executed if left key is pressed
|<end>
|<if><key[ right ]pressed?>
||Code to be executed if right key is pressed
|<end>
<end>
Offline