Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How Can I Make A Character Die?
- Tiger_Infinite
-
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
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
-
100+ posts
How Can I Make A Character Die?
Did you use a broadcast block to tell all the sprites to hide?
- TheMarshn
-
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
-
59 posts
How Can I Make A Character Die?
The best way to do this would beforever // 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
-
8 posts
How Can I Make A Character Die?
Hi, Scratchers!
Thanks for the replies!
Question: How do I create a message?
- Tiger_Infinite
Thanks for the replies!
Question: How do I create a message?
- Tiger_Infinite
- MollyandMilodog
-
100+ posts
How Can I Make A Character Die?
what do you mean by that. Hi, Scratchers!
Thanks for the replies!
Question: How do I create a message?
- Tiger_Infinite
- llloofagelll
-
16 posts
How Can I Make A Character Die?
The best way to do this would beforever // 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 clickedthis does mean that whenever you press the stop button it game overs.
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
Or whenever you press see inside
Last edited by llloofagelll (Oct. 17, 2020 20:20:12)
- vallere702
-
100+ posts
How Can I Make A Character Die?
A message can be created using the Hi, Scratchers!
Thanks for the replies!
Question: How do I create a message?
- Tiger_Infinite
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
-
8 posts
How Can I Make A Character Die?
what do you mean by that. Hi, Scratchers!
Thanks for the replies!
Question: How do I create a message?
- Tiger_Infinite
Wait, I just said thanks for the replies, or in other terms, thanks for the help.
- MollyandMilodog
-
100+ posts
How Can I Make A Character Die?
You had a question that was what do you mean by thatwhat do you mean by that. Hi, Scratchers!
Thanks for the replies!
Question: How do I create a message?
- Tiger_Infinite
Wait, I just said thanks for the replies, or in other terms, thanks for the help.
- Tiger_Infinite
-
8 posts
How Can I Make A Character Die?
Hey, Scratchers!
Oh, I didn't know how to create a message with the:
- Tiger_Infinite
Oh, I didn't know how to create a message with the:
broadcast [ v]
- Tiger_Infinite
- Tiger_Infinite
-
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
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
-
5 posts
How Can I Make A Character Die?
“But, I really need to know another way of making this script.” 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
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
-
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
-
100+ posts
How Can I Make A Character Die?
Hi, Scratchers!
Thanks for the replies!
Question: How do I create a message?
- Tiger_Infinite
make a new topic, you arent allowed to necropost which blocks should I use to make my game end if they die step by step

- Discussion Forums
- » Help with Scripts
-
» How Can I Make A Character Die?