I'm expecting the sprite to always glide to x/y on line 4 in the first thread which works great. However, when line 3 and 4 are triggered in the second thread, line 7 and 8 do not execute.
It seems to be stuck on glide from thread 1 line 4 and the sprite never executes line 7-8 from thread 2. It switches costume from line 5 in the second thread, waits 2 seconds, then switches costume from line 9 in the second thread but continues gliding.
How can I stop a glide after a broadcasted event?
Thanks for your help.
Thread 1
1 when key pressed
2 forever
3 go to x/y
4 glide 10s to x/y
5 switch costume
6 go to x/y
7 stop script
Thread 2
1 when flag clicked
2 forever
3 if touching sprite2
4 broadcast event
5 switch costume
6 wait 2s
7 hide
8 go to x/y
9 switch costume
10 show
Offline
To add:
The sprite starts at the top of the screen and when you press the 1 key it glides towards the bottom. If it comes in contact with another sprite, thread 2 starts. It's supposed to change costumes, wait, then reset back to the top again.
(Can't edit posts, sorry for spamming)
Offline

It's okay. Anyway, there is only one way that I know of to stop a glide block, and that involves broadcasts. Anyway, here it is:
when I receive [gliding1 v] if <(glide) = (1)>//Or whatever tells you if you should be gliding or not. glide (Filler) secs to x: (Filler) y: (Filler) endJust use [broadcast [gliding1 v] until done] if you need your sprite to do some gliding. Also, when you need to interrupt the gliding, just broadcast gliding1 again. Anyway, I hope that this helps!
Last edited by ErnieParke (2012-10-16 16:56:47)
Offline
ccheney wrote:
Thanks for trying to help but I don't quite understand what your script is doing
![]()
It's okay! The script I made is supposed to allow you to be able to interrupt the glide block and to execute lines 7-8 of your second script.
Last edited by ErnieParke (2012-10-17 06:12:41)
Offline