Well, what you should do is make a "subroutine" of sorts that handles scoring. So if you want to increment the score by something, send a "score" message. In the stage's scripts, make a script that starts with "when I receive score" that will handle the score. Have it increment the score, and then have it do an if check to see "if score = x" and act accordingly. If you check out the code for Grumpy Wizard, you'll see this is how I changed the player's level and made the witches fly faster.
Offline
7h0mas wrote:
how do I make something die when I make something hit it and how do I amke a fight and how do I give objects health????
A vague reply to a vague question ;-)
To kill something...
Add Costumes to your sprite for explosions and dead guys. When they get shot use the
Looks instruction:
Switch To Costume SomeName
or use a
Repeat loop
- Next costume
Until dead
In a fight...
Make Variables for Life and Health and give them a value of 10 (or whatever you want) at the start.
When a sprite is shot use Variables instruction - Change Life by -1
Then check..
If Life = 0
do the death stuff
Offline
If you have the score in a global variable, then all of the sprites are able to listen to that variable. Anywhere in any script you can put something like "If ( Score > 100 )" and if that code runs when the score is more than a hundred, it'll do what's inside the If block.
That's part of what's neat about Scratch, is you don't have to put everything all in one place. You can decide for each object how it's going to react to the score, to other objects, etc, & then it all comes together in the end. If all of the sprites are programmed to do something exciting when the score gets to be high enough, then when you get to the right score-- yeah, everybody's dancing!
<3
Offline