Hey guys how do i stop i script when a sprite hides? Okay here's what i'm doing. I am making a shooting game. I made this sprite shoot every 3 seconds and when it gets hit by another sprite, it hides. But the problem is, the bullet wont stop shooting, how can i fix this?
Offline
If the bullet touches the sprite that hides you can us "repeat until" and the "touching sprite that hides"
you could use a variable so when the sprite gets hit it changes the variable so that the bullet sprite stops.
You put an if statment in the bullet sprite
like this "IF Variable = 1, set variable to 0, stop script"
You then put a statment in the hiding sprite like this "(when the sprite hides statment) set variable to 1". <-- all you do is add this statment to the existing statment
Offline
Try this andrew. Put this on all of the sprites except for the one that is shooting.
<when green flag clicked>
<forever>
<if><touching[
<broadcast[ die
Put the below script on the bullets themselves:
<when I receive[ die
<stop script>
Offline
steppenwulf wrote:
Try this andrew. Put this on all of the sprites except for the one that is shooting.
<when green flag clicked>
<forever>
<if><touching[
<broadcast[ die
Put the below script on the bullets themselves:
<when I receive[ die
<stop script>
That won't work steppun, the stop script button only works for the script it is in.
Put that stop script block directly after the hide block in your script. That should work.
Offline
Try this:
[blocks]
<when green flag clicked>
<forever>
<if> <touching[ Whatever Kills You]
<hide>
<stop script>
<end>
<end>
[/blocks]
Last edited by demosthenes (2009-10-25 09:58:48)
Offline