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

#1 2008-04-20 22:27:26

hp001
Scratcher
Registered: 2008-04-20
Posts: 4

Mouse on 1 sprite and getting another to say something

I'm trying to make it so that when I place the mouse pointer on another sprite in the game that the active sprite says something. Can someone help me with that please?

Offline

 

#2 2008-04-20 22:51:48

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Mouse on 1 sprite and getting another to say something

Simple:
[blocks]
<when green flag clicked>
<forever>
<if><touching[ mouse pointer ?
<say[ Blah ]for( 2 )secs>
<end>
<end>
[/blocks]
Put the code into the sprite that you want to say something

Offline

 

#3 2008-04-21 01:23:32

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

Re: Mouse on 1 sprite and getting another to say something

That would get the sprite being touched to say something, which isn't what hp001 was asking for.

Instead, on the sprite to be touched use:

When Green Flag Clicked
Forever
- if touching mouse pointer
- broadcast "Speak"
- wait until not touching mousepointer

Then on the active sprite:

When I recieve "Speak"
Say "My message is..." for 2 seconds.


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