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

#1 2013-02-27 20:12:56

Waffle27
Scratcher
Registered: 2012-03-21
Posts: 1000+

Is it possible to do this?

I was wondering if it was possible to have one sprite do something when another sprite is clicked? If so, how do I do it? If not, thanks anyway for reading this.

Offline

 

#2 2013-02-27 21:11:31

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: Is it possible to do this?

The first sprite's script needs to be

when gf clicked
forever
    if <<touching [mouse pointer v]?> and <mouse down?>>
        broadcast [broadcast1 v]
    end
end
The second sprite's script needs to be
when I receive [broadcast1 v]
do stuff

Last edited by henley (2013-02-27 21:15:05)


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#3 2013-02-27 21:48:24

Waffle27
Scratcher
Registered: 2012-03-21
Posts: 1000+

Re: Is it possible to do this?

Thanks!  smile

Offline

 

#4 2013-03-03 04:56:18

topazdragonlord
Scratcher
Registered: 2013-02-22
Posts: 500+

Re: Is it possible to do this?

you could also try

when sprite1 clicked
broadcast yourmessagehere
second sprite:

when i receive yourmessagehere
then add what you want the second sprite to do.  big_smile


http://i45.tinypic.com/idumbk.png

Offline

 

#5 2013-03-03 09:22:18

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: Is it possible to do this?

topazdragonlord wrote:

you could also try

when sprite1 clicked
broadcast yourmessagehere
second sprite:

when i receive yourmessagehere
then add what you want the second sprite to do.  big_smile

That's the exact same thing as mine, except you used the hat block instead of the script, which makes things more glitchy.


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#6 2013-03-03 09:29:32

BLU_Spy
Scratcher
Registered: 2012-01-05
Posts: 1000+

Re: Is it possible to do this?

topazdragonlord wrote:

you could also try

when [sprite1 v] clicked
broadcast [yourmessagehere v]
second sprite:

when i receive [yourmessagehere v]
then add what you want the second sprite to do.  big_smile

Fixed.


I HAVE SWITCHED ACCOUNTS! My new username is NoxSpooth.

Offline

 

#7 2013-03-03 21:16:48

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Is it possible to do this?

henley wrote:

topazdragonlord wrote:

you could also try

when sprite1 clicked
broadcast yourmessagehere
second sprite:

when i receive yourmessagehere
then add what you want the second sprite to do.  big_smile

That's the exact same thing as mine, except you used the hat block instead of the script, which makes things more glitchy.

Actually, your script isn't quite the same.  If you hold down the mouse and then move it onto the sprite it will register as a "click" which doesn't appear (to me) to be what Waffle27 wanted.

Why do hat blocks make things more glitchy?

Last edited by MoreGamesNow (2013-03-03 21:17:56)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer