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

#1 2011-06-02 16:36:59

naduking
Scratcher
Registered: 2011-01-30
Posts: 4

changing sprite costume only when mouse pointer touches

working on a program and I want the sprite costume 1 to change to costume 2 when the mouse pointer touches it THEN back to costume 1 when the mouse pointer moves away.
Need help with script please

Offline

 

#2 2011-06-02 16:39:30

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: changing sprite costume only when mouse pointer touches

I believe this will do what you want:
http://i56.tinypic.com/1448fux.gif


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#3 2011-06-02 16:48:24

naduking
Scratcher
Registered: 2011-01-30
Posts: 4

Re: changing sprite costume only when mouse pointer touches

Thanks for the quick response! That worked!

Offline

 

#4 2011-06-02 19:03:28

Prestige
Scratcher
Registered: 2008-12-15
Posts: 100+

Re: changing sprite costume only when mouse pointer touches

naduking wrote:

working on a program and I want the sprite costume 1 to change to costume 2 when the mouse pointer touches it THEN back to costume 1 when the mouse pointer moves away.
Need help with script please

>>        The scripting in the comment above will work as you want. If you want to try some other effects then try leaving the costume the same but where (in the script above) the costume is set, use "ghost" or "brightness" values from the looks palette. This can be used on menu buttons, where if the mouse is touching the button, "set brightness to 0", else "set brightness -10".
           if you want to continue this further by adding clickable functionality (so something happens when the sprite is clicked), add an "if" loop inside the "If - touching mouse pointer" and then the function (broadcast start game for example).  This means you can have compact scripts and that the *broadcast start game* block will only happen IF its touching the mouse pointer + the mouse is clicked.

Hope this helps you futher!! big_smile

Prestige  smile


"Don't insult someone until you've walked a mile in their shoes. That way, if they don't like what you have to say, you'll be a mile away and still have their shoes  smile  "

Offline

 

#5 2011-06-15 22:02:53

Feey1
Scratcher
Registered: 2011-06-14
Posts: 23

Re: changing sprite costume only when mouse pointer touches

Hi. I'm trying to get my Script to change to costume a when I click on my 2nd Sprint. Please tell me how to do so.


https://lh4.googleusercontent.com/-_PaQ0jKtwj4/TijtgXtSfVI/AAAAAAAADcM/NGpGu5y7aog/Super%252520Snail%252520Games%252520rulez%252521.jpg
Drew it myself!

Offline

 

#6 2011-06-15 22:06:55

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: changing sprite costume only when mouse pointer touches

Feey1 wrote:

Hi. I'm trying to get my Script to change to costume a when I click on my 2nd Sprint. Please tell me how to do so.

I believe this is what you're looking for:

Code:

First Sprite:
When Sprite1 clicked
Broadcast "clicked"

Second Sprite:
When I receive "clicked"
Next Costume

Hope that helps you!


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#7 2011-06-15 22:11:43

Feey1
Scratcher
Registered: 2011-06-14
Posts: 23

Re: changing sprite costume only when mouse pointer touches

It kind of. The problem is I can't find the buttons to do that. Please tell me what category Broadcast "clicked" is?


https://lh4.googleusercontent.com/-_PaQ0jKtwj4/TijtgXtSfVI/AAAAAAAADcM/NGpGu5y7aog/Super%252520Snail%252520Games%252520rulez%252521.jpg
Drew it myself!

Offline

 

#8 2011-06-15 22:41:17

jji7skyline
Scratcher
Registered: 2010-03-08
Posts: 1000+

Re: changing sprite costume only when mouse pointer touches

Feey1 wrote:

It kind of. The problem is I can't find the buttons to do that. Please tell me what category Broadcast "clicked" is?

In the orange control section...


I don't know why you say goodbye, I say hello!  big_smile

Offline

 

#9 2011-06-15 22:58:43

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: changing sprite costume only when mouse pointer touches

Feey1 wrote:

It kind of. The problem is I can't find the buttons to do that. Please tell me what category Broadcast "clicked" is?

It's this block, in the Control section.

http://wiki.scratch.mit.edu/images/Broadcast_%28%29.png

Last edited by Harakou (2011-06-15 22:58:49)


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

Board footer