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
jontmy00 wrote:
zammer990 wrote:
Fixedwhenclicked
forever ifhealth>0repeat330/speedmovespeedstepsNow 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:
I'm a little confused as to why you had a "repeat" block within a forever loop thoughrepeat untilnothealth>0movespeedsteps
Offline
MoreGamesNow wrote:
jontmy00 wrote:
zammer990 wrote:
Fixedwhenclicked
forever ifhealth>0repeat330/speedmovespeedstepsNow 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:I'm a little confused as to why you had a "repeat" block within a forever loop thoughrepeat untilnothealth>0movespeedsteps![]()
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
in the middle of a loop.iforhealth=0health<0stop script
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:
The scripts may vary.Whenclicked
Wait untiltimer=time you want it to movethis may varyRepeat untilorhealth=0touchingend point ▼?Do movement scriptshide
Last edited by turkey3 (2012-05-12 14:29:36)
Offline