I think that it would be most useful for a <repeat until> block. You see I am making a tank game where I would like the bullet you shoot to come back to the tank and keep up with it but in order to do this I have to make forever go to sprite 2. But I want the bullet to move away from it when you press space.
Offline
<when green flag clicked>
<forever>
<go to[ sprite 2
<if> <key[ space ]pressed?>
<repeat until> <touching[ edge
<move( 5 )steps>
Offline
their is a repeat until block
Offline
Try this:
[blocks]
<when green flag clicked>
<go to[ Sprite2 (so it starts there)
<forever>
<if> <key[ space ]pressed?> (space to launch the bullet)
<point towards( mouse-pointer (use the mouse to aim)
<repeat until> <touching[ edge
<move( 5 )steps> (keep moving until touching the edge)
<end>
<if> <touching[ edge (when touched the edge...)
<go to[ Sprite2 (go to Sprite2)
<end>
<wait until> <key[ space ]pressed?> (so you can do it again.)
<end>
<end>
[/blocks]
I put it in words so you don't get confused.
It's complicated, but it works. I used it in my Oncoming game and my City Attack game.
Last edited by Kingdaro (2008-07-13 14:52:44)
Offline
deatheater wrote:
<when green flag clicked>
<forever>
<go to[ sprite 2
<if> <key[ space ]pressed?>
<repeat until> <touching[ edge
<move( 5 )steps>
[/blocks]
Where it says [blocks] <go to[ Sprite2 [/blocks] It'll keep doing that forever. So you have to make an "Unless" rule to say NOT to do that if the space key is pressed.
Last edited by Kingdaro (2008-07-12 15:30:54)
Offline
Kingdaro wrote:
deatheater wrote:
<when green flag clicked>
<forever>
<go to[ sprite 2
<if> <key[ space ]pressed?>
<repeat until> <touching[ edge
<move( 5 )steps>[/blocks]
Where it says [blocks] <go to[ Sprite2 [/blocks] It'll keep doing that forever. So you have to make an "Unless" rule to say NOT to do that if the space key is pressed.
yes it will forever go to sprite 2 until key space pressed then it will repeat until hitting the wall then go to sprite 2 again
Offline