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

#1 2010-05-26 06:49:39

msa969
Scratcher
Registered: 2010-04-11
Posts: 3

How do I get a sprite to show if one sprite is hidden or dies?

Hello

I have a sprite called blobby and a bullet sprite. When the bullet sprite touches blobby, blobby hides and a counter called point increases by 1. Note the code works but I guess it could have been written better. I have two blobbies on screen at the start. How do I get more blobbies to appear on stage when one dies? Thank you in advance.

Offline

 

#2 2010-05-26 08:26:19

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: How do I get a sprite to show if one sprite is hidden or dies?

There's really no way to dynamically duplicate the blobbies...I would just reuse the blobbies that are already dead like this:

Code:

//Use the "get a blobby" broadcast to resurrect a blobby that's already dead
//We have a variable we need to set called "need a blobby"

When I receive [blobby death]:
  set need a blobby to 1
  broadcast [get a blobby]

//This code goes on the blobbies:

When I receive [get a blobby]:
  if <i am dead = 1>:
    //do something to make me alive again...
    set need a blobby to 0

That way you can have "infinite" blobbies, as long as there are never too many on screen at once.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#3 2010-05-27 04:58:10

msa969
Scratcher
Registered: 2010-04-11
Posts: 3

Re: How do I get a sprite to show if one sprite is hidden or dies?

Thank you fullmoon,

I will give this a go.

Just one final question

how do I broadcast blobby is dead?

And will i check for the broadcast on the blobby?

Offline

 

#4 2010-05-27 08:58:27

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: How do I get a sprite to show if one sprite is hidden or dies?

msa969 wrote:

Thank you fullmoon,

I will give this a go.

Just one final question

how do I broadcast blobby is dead?

And will i check for the broadcast on the blobby?

That's sort of up to you. I guess I would broadcast [blobby death] from a blobby when it dies (i.e., right after the "hide" block).

And no, that script is supposed to go on the stage.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

Board footer