This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-06-22 20:29:54

clapmatt
Scratcher
Registered: 2007-06-19
Posts: 18

Stopping Sensing

Is there a way for one sprite to tell if another sprite stopped moving?

Offline

 

#2 2007-06-22 20:31:04

clapmatt
Scratcher
Registered: 2007-06-19
Posts: 18

Re: Stopping Sensing

I meant if there was a way for that sprite to do something when it stops moving.

Offline

 

#3 2007-06-22 20:44:33

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Stopping Sensing

If the other sprite knows when it stops, it can
    broadcast sprite-one-stopping
and other sprites can use the message to start some action.

That is probably more reliable than watching for the x y position not to change for a while, which is what you would have to do to see the mouse stop moving.

Offline

 

#4 2007-06-22 20:49:29

clapmatt
Scratcher
Registered: 2007-06-19
Posts: 18

Re: Stopping Sensing

kevin_karplus wrote:

If the other sprite knows when it stops, it can
    broadcast sprite-one-stopping
and other sprites can use the message to start some action.

That is probably more reliable than watching for the x y position not to change for a while, which is what you would have to do to see the mouse stop moving.

I meant how could the sprite sense when it stops. So say sprite1 moves toward a random place. Is there a way to sense when the spirte gets to this place? (Note: I'm not asking if it can sense Where it is, I asking if it can sense When it stops)

Offline

 

#5 2007-06-23 03:10:35

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: Stopping Sensing

It depends on how you tell the sprite to move.

I'd need to check, but I think if you used the glide command to go to x,y, the next instructions will not happen until it arrives.

If that isn't the case then having given a glide command you can either put a "wait" with the same duration immediately afterwards or a "wait until x sad x) AND y sad y).

Then put whatever it is you want to happen on stopping after that command.

***

Conversely, if the sprite in question is directly controlled by the player, then you would only need to check that it wasn't recieving a move instruction.

Unless its a permanently moving sprite that the player only steers, like Pacman or my powerboat.  Then it gets more complicated...


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

Board footer