Discuss Scratch

Tiger_Infinite
Scratcher
8 posts

How Can I Make A Character Die?

Hello, Scratchers!

Now, I'm creating a game. Basically, there is a bat, and he has to avoid obstacles, and I'm trying to code the part when the character hits an obstacle. But, here's the problem: I've been trying to make a code, which basically says if this sprite touches the obstacle, switch to GAME OVER. All the sprites will disappear, by the way. But, I really need to know another way of making this script. I'll be trying another way, whilst I see the replies.

- Tiger_Infinite
MollyandMilodog
Scratcher
100+ posts

How Can I Make A Character Die?

Did you use a broadcast block to tell all the sprites to hide?
TheMarshn
Scratcher
82 posts

How Can I Make A Character Die?

The best way to do this would be
forever // in your character sprite
if <touching [enemy v]> then
broadcast [game over v]
end
end

when I receive [game over v] //in each of the sprites you want to disappear
hide

when I receive [game over v] //in your game over sprites
show
WhoeverKnew123
Scratcher
59 posts

How Can I Make A Character Die?

TheMarshn wrote:

The best way to do this would be
forever // in your character sprite
if <touching [enemy v]> then
broadcast [game over v]
end
end

when I receive [game over v] //in each of the sprites you want to disappear
hide

when I receive [game over v] //in your game over sprites
show

I learned that myself like 3 days ago!!!
Tiger_Infinite
Scratcher
8 posts

How Can I Make A Character Die?

Hi, Scratchers!

Thanks for the replies!

Question: How do I create a message?

- Tiger_Infinite
MollyandMilodog
Scratcher
100+ posts

How Can I Make A Character Die?

Tiger_Infinite wrote:

Hi, Scratchers!

Thanks for the replies!

Question: How do I create a message?

- Tiger_Infinite
what do you mean by that.
llloofagelll
Scratcher
16 posts

How Can I Make A Character Die?

TheMarshn wrote:

The best way to do this would be
forever // in your character sprite
if <touching [enemy v]> then
broadcast [game over v]
end
end

when I receive [game over v] //in each of the sprites you want to disappear
hide

when I receive [game over v] //in your game over sprites
show

I have a different method:
when green flag clicked
forever // in your character sprite
if <touching [enemy v]> then
stop [all]
end
end

when [timer v] > (0.01) //in each of the sprites you want to disappear
hide

when [timer v] > (0.01) //in your game over sprite/sprites
show

when green flag clicked
forever
reset timer
end
this does mean that whenever you press the stop button it game overs.
Or whenever you press see inside

Last edited by llloofagelll (Oct. 17, 2020 20:20:12)

vallere702
Scratcher
100+ posts

How Can I Make A Character Die?

Tiger_Infinite wrote:

Hi, Scratchers!

Thanks for the replies!

Question: How do I create a message?

- Tiger_Infinite
A message can be created using the
 broadcast [message1 v] 
block. simply click on the drop-down menu, then choose new message, enter a name, and you can now use a message to broadcast to other blocks!
Tiger_Infinite
Scratcher
8 posts

How Can I Make A Character Die?

MollyandMilodog wrote:

Tiger_Infinite wrote:

Hi, Scratchers!

Thanks for the replies!

Question: How do I create a message?

- Tiger_Infinite
what do you mean by that.

Wait, I just said thanks for the replies, or in other terms, thanks for the help.
MollyandMilodog
Scratcher
100+ posts

How Can I Make A Character Die?

Tiger_Infinite wrote:

MollyandMilodog wrote:

Tiger_Infinite wrote:

Hi, Scratchers!

Thanks for the replies!

Question: How do I create a message?

- Tiger_Infinite
what do you mean by that.

Wait, I just said thanks for the replies, or in other terms, thanks for the help.
You had a question that was what do you mean by that
Tiger_Infinite
Scratcher
8 posts

How Can I Make A Character Die?

Hey, Scratchers!

Oh, I didn't know how to create a message with the:
broadcast [ v]

- Tiger_Infinite
Tiger_Infinite
Scratcher
8 posts

How Can I Make A Character Die?

Hey Scratchers,

Thanks for the help. I appreciate it!

Thanks to llloofagelll for the alternative way. That was what helped me out.

I may need help on another topic since I'm very young (I'm not telling my age, it's personal info). I haven't really used Scratch, I'm usually into script coding.

- Tiger_Infinite
sflilymNEW1
Scratcher
5 posts

How Can I Make A Character Die?

Tiger_Infinite wrote:

Hello, Scratchers!

Now, I'm creating a game. Basically, there is a bat, and he has to avoid obstacles, and I'm trying to code the part when the character hits an obstacle. But, here's the problem: I've been trying to make a code, which basically says if this sprite touches the obstacle, switch to GAME OVER. All the sprites will disappear, by the way. But, I really need to know another way of making this script. I'll be trying another way, whilst I see the replies.

- Tiger_Infinite
“But, I really need to know another way of making this script.”

Well, try creating a non-cloud variable and calling it Lives. The best way is to have at least three lives, even if the bat has to avoid obstacles. Then go to the Sensing blocks and grab a touching ( ) ? and select the sprite you want the bat to lose lives from. then grab an if < > then block and put the Sensing block in the top part. Lastly, find the Lives variable, and when the Flag is clicked, set Lives to 3, then use another variable block and put that in the Sensing code. It should be like this: If <touching ( square )?> Then change Lives by -1.
hood344
Scratcher
1 post

How Can I Make A Character Die?

which blocks should I use to make my game end if they die step by step
DMU_Mapping
Scratcher
100+ posts

How Can I Make A Character Die?

Tiger_Infinite wrote:

Hi, Scratchers!

Thanks for the replies!

Question: How do I create a message?

- Tiger_Infinite

hood344 wrote:

which blocks should I use to make my game end if they die step by step
make a new topic, you arent allowed to necropost

Powered by DjangoBB