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

#1 2012-04-23 10:48:41

Lilhardy94
Scratcher
Registered: 2012-04-12
Posts: 25

How do i use a sprite as a button

i want to use a sprite as a button so when i click it it broadcasts a answer to the program could you show me the coding to do so please

Offline

 

#2 2012-04-23 11:03:33

stevetheipad
Scratcher
Registered: 2011-08-06
Posts: 1000+

Re: How do i use a sprite as a button

Hey, and welcome to Scratch, Lilhardy94! Actually, since this topic is about script help, it belongs in the Help With Scripts forum section. I've asked a community moderator to move it there, so that's where you'll probably find it next time you look for this topic.  wink

You'll want to first do this script:

when gf clicked
show
on the sprite button. (You'll also want to make sure the sprite isn't blank, change it in the costume tab)

Then, you'll want to do this:
When (sprite1) clicked
broadcast (broadcast1)
And then to make it do something when the broadcast is sent, build onto this:
When I receive (broadcast1)

Last edited by stevetheipad (2012-04-23 11:04:16)


http://i.imgur.com/0x8ia.jpg
gone

Offline

 

#3 2012-04-23 11:03:55

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: How do i use a sprite as a button

I've just moved this over to the "Help with Scripts" forum, for you, Lilhardy94  smile

And may I say: Welcome to Scratch!

Under the yellow "Control" section of the Scratch program, you should see this block:

when sprite clicked
To use it with a broadcast, attatch a broadcast block to the bottom:

when sprite clicked
broadcast [message v]
Wow. I totally failed to get the block to work in this post! Stevetheipad has answered the question above while I was writing, though, so listen to him!  wink

Last edited by sparks (2012-04-23 11:05:43)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#4 2012-04-23 11:11:07

stevetheipad
Scratcher
Registered: 2011-08-06
Posts: 1000+

Re: How do i use a sprite as a button

sparks wrote:

Wow. I totally failed to get the block to work in this post! Stevetheipad has answered the question above while I was writing, though, so listen to him!  wink

Hehe, I beat-cha to it.  smile

And sparks: use "When (sprite) clicked" instead of "When sprite clicked", and broadcast names live in parenthesis, too.


http://i.imgur.com/0x8ia.jpg
gone

Offline

 

Board footer