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

#1 2007-05-17 17:33:25

wade11
Scratcher
Registered: 2007-05-16
Posts: 8

How do i....

ok so how do i make it do something when i have the score at a specific number?

Offline

 

#2 2007-05-17 18:32:32

rszrama
Scratcher
Registered: 2007-05-15
Posts: 25

Re: How do i....

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

 

#3 2007-05-17 19:07:46

wade11
Scratcher
Registered: 2007-05-16
Posts: 8

Re: How do i....

Thanks soooo much saved me a long time being white an nerdy(not being racist)

Offline

 

#4 2007-05-19 08:00:58

7h0mas
Scratcher
Registered: 2007-05-19
Posts: 1

Re: How do i....

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????

Offline

 

#5 2007-05-19 08:23:28

Duncan
Scratcher
Registered: 2007-05-15
Posts: 47

Re: How do i....

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

 

#6 2007-05-20 03:41:37

mungojelly
Scratcher
Registered: 2007-05-19
Posts: 35

Re: How do i....

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

 

Board footer