Hi
I've got a script and I've been playing with it for a while (it's for a TD game) and I'm trying to find a way to stop the enemies moving after they die, so far I've tried a few things, this is a sample of the code:
[scratchblocks]
when gf clicked
forever if <(health) > [0]>
repeat ((330) / (speed)
move (speed) steps
end
end
[scratchblocks]
so far it isn't working, the repeat move script is repeated with turns for every corner
Any ideas?
Offline
You will have to use the stop script block. It is at the end of the yellow colored script parts in the program.
Offline
zammer990 wrote:
when gf clicked forever if <(health) > [0]> repeat ((330) / (speed)) move (speed) steps end endFixed
Now it's really fixed. Your "repeat" block was faulty.
Offline
jontmy00 wrote:
zammer990 wrote:
when gf clicked forever if <(health) > [0]> repeat ((330) / (speed)) move (speed) steps endFixedNow it's really fixed. Your "repeat" block was faulty.
Triple fixed (got rid of bump at the end )
@"stop all scripts in sprite" block: I think somebody's made that a suggestion. But you're right, it would be quite useful. As for the forever script, I would use a repeat until loop:
repeat until<not <(health) > (0)>> move (speed) steps endI'm a little confused as to why you had a "repeat" block within a forever loop though
Offline
MoreGamesNow wrote:
jontmy00 wrote:
zammer990 wrote:
when gf clicked forever if <(health) > [0]> repeat ((330) / (speed)) move (speed) steps endFixedNow it's really fixed. Your "repeat" block was faulty.
Triple fixed (got rid of bump at the end )
@"stop all scripts in sprite" block: I think somebody's made that a suggestion. But you're right, it would be quite useful. As for the forever script, I would use a repeat until loop:repeat until<not <(health) > (0)>> move (speed) steps endI'm a little confused as to why you had a "repeat" block within a forever loop though
Yea, I got rid of that after I fixed it, using repeat until simply halts it after the code finishes, not mid way
Offline
You could do
if <<(health) = (0)> or <(health) < (0)>> stop script endin the middle of a loop.
Offline
In most tower defense games, the enemies stop moving either when they reach the end or are beat. Also, you will need to make a sprite for the end point. This would work:
When gf clicked Wait until <(timer) = [time you want it to move]> // this may vary Repeat until <<(health) = [0]> or <touching [end point v]?>> Do movement scripts End hideThe scripts may vary.
Last edited by turkey3 (2012-05-12 14:29:36)
Offline