Do you want one of your sprites to hide during your game or animation?
For example, say you want Sprite2 to make Sprite1 disappear when it touches it.
Here's one way to program it:
Sprite2:
[blocks]
<forever>
<if><touching[ Sprite1
<broadcast[ TimeToHide
<end>
<end>
[/blocks]
Sprite1:
[blocks]
<when green flag clicked>
<show>
<when I receive[ TimeToHide
<hide>
[/blocks]
As you can see, Sprite2 "broadcasts" a message to Sprite1. When Sprite1 receives the message, it hides. (You need a "show" to make the sprite reappear again each time you run the program.)
Thanks to yambanshee for suggesting this FAQ topic. Please add any suggestions, corrections, or questions.
Offline
Also if you want the same thing to happen just in reverse (meaning if a sprite is already hiding) you would do
SPrite 2
<forever><if><(<distance to[ sprite one <<> 10 )> <broadcast[ time to show
Sprite 1
<when green flag clicked><hide>
<when I receive[ time to show
<show>
Offline
bosox397
Good game!
Offline
I'm trying to make a game where when the dog touches the cat you lose but I can't get my "Game Over" sprite to appear ans stop the game when and only when the dog sprite touches the cat sprite. can anyone please help me figure this out.
Offline
Greatdane wrote:
Mrbus wrote:
i kind of mean
[blocks]<when I receive[ show list show variable list[/blocks]You can't.
You can, but you must hack scratch. Look at nXIII's Tutorial
EDIT: PLEASE USE THE
[blocks][/blocks]
TAGS BEFORE/AFTER YOU TYPING BLOCKS!
Last edited by meew0 (2010-04-13 15:45:53)
Offline
http://scratch.mit.edu/forums/viewtopic.php?id=11796#req_messagehttp://scratch.mit.edu/forums/viewtopic.php?id=11796#req_messagehttp://scratch.mit.edu/forums/viewtopic.php?id=11796#req_messagehttp://scratch.mit.edu/forums/viewtopic.php?id=11796#req_messagehttp://scratch.mit.edu/forums/viewtopic.php?id=11796#req_messagehttp://scratch.mit.edu/forums/viewtopic.php?id=11796#req_messagehttp://scratch.mit.edu/forums/viewtopic.php?id=11796#req_message
Offline
what on earth is this forum?
Offline
BigDolphin wrote:
what on earth is this forum?
the scratch website forum
Offline
For mason wiz you could just do this when<when green flag clicked<forever if><touching color[ whatever color you want<broadcast[444 and for the game over sprit e you make it hide when flag clicked and this script<when I receive[ 444<show>
Offline
Quite right. I tested it, and so far it works.
Offline
masonwiz wrote:
I'm trying to make a game where when the dog touches the cat you lose but I can't get my "Game Over" sprite to appear ans stop the game when and only when the dog sprite touches the cat sprite. can anyone please help me figure this out.
example
What you need to do is use broadcast if dog that's sprite one touches cat sprite 2
hide, use it for cat and dog. and with cat or dog when it touches one another,
broadcast to your game over, it could be called any name you wish.
like this
If dog touches cat hide then broadcast game over
and put the same in for the cat
go to game over
put in
when I receive game over show and stop all. Its up to you how many seconds you want it to happen that is the wait tool
that should solve it
Last edited by galogalo4 (2010-06-01 06:14:47)
Offline
Make an invisble costume for the sprite and do this small script:
<when[ any key ]key pressed>
<switch to costume[ the invisible costume you made
thats just another way to do it.get it
i actually made this up...
Offline
You can't make a costume with nothing in it... But you can make the costume look like what's behind it.
Offline
Jonathanpb wrote:
You can't make a costume with nothing in it... But you can make the costume look like what's behind it.
You can make a costume with absolutely nothing in it, I can't remember how but I have done so.
Offline
I have a question: How do I hide my Sprite during the first few levels and make it appear in the last?
Offline
Pencilmaster wrote:
I have a question: How do I hide my Sprite during the first few levels and make it appear in the last?
try using the [blocks] <show> [/blocks] and [blocks] <hide> [/blocks]
Offline
You can''t. At least not now.
Mrbus wrote:
i would like to know if you can hide a list in scratch.
<hide>
Offline
Mrbus wrote:
i would like to know if you can hide a list in scratch.
<hide>
Unfortunately you can't at the moment, but I'm hoping it'll be possible in 2.0
Offline