Discuss Scratch

Binary_Leader
New Scratcher
2 posts

"Glide to" command interuption

Hello Everybody,

just thinking about “glide to” command interuption while this command is beiing processed.

For example, there is an object, which is moving through the screen to some position used glide to command for 3 seconds, but I want to check during this motion, if conditions for this move are still keeped, for example each 100ms.
awesome-llama
Scratcher
1000+ posts

"Glide to" command interuption

The glide blocks are a bit limiting as they can't easily be stopped.
The way I know to stop it is through this block:

stopother scripts in sprite

Just note that it will stop all other scripts in the sprite, except itself.
Binary_Leader
New Scratcher
2 posts

"Glide to" command interuption

Yes, stop all other scripts is not good solution in this case. Probably only solution is to divide the trajectory to small partitions and after each movement perform other code part. This is unnecessarily complicated.
MasterofTheBrick
Scratcher
1000+ posts

"Glide to" command interuption

Or you could just point in the direction of the place you want to go, and repeatedly use the move () steps block. It would be easier to stop the movement using variables rather than using the stop block and potentially causing the more important scripts in your sprite to stop as well.
TommyNator11
Scratcher
63 posts

"Glide to" command interuption

Binary_Leader wrote:

Yes, stop all other scripts is not good solution in this case. Probably only solution is to divide the trajectory to small partitions and after each movement perform other code part. This is unnecessarily complicated.
I would never use a “Glide to Block” for projectiles. If you want to inturrupt it, use
repeatuntilinturruptedpointtowardsdestinationmove5steps

Powered by DjangoBB