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

#1 2010-10-31 11:08:09

jcorules
Scratcher
Registered: 2010-03-07
Posts: 8

scoring variables

I am creating a maze game and when you hit the outline of the maze (which is a Sprite) it decreases your lives by -1. I'd like to end the game when your lives hit 0, but I can't figure out a way to get it to end...the variable just keeps decreasing by -1 infinitely.

Here is my script for one of my directions:
when down arrow key pressed
point in direction 180
move 10 steps
if touching Sprite 1
change x by -1
if x=0
broadcast You Lose

Any help is appreciated! Thanks!!

Offline

 

#2 2010-10-31 11:25:28

meowmeow55
Scratcher
Registered: 2008-12-24
Posts: 1000+

Re: scoring variables

Try using
[blocks]<if> <(  <{ x  }> <<> 1 )>[/blocks]
instead of
[blocks]<if> <(  <{ x  }> <=> 0 )>[/blocks]


Yawn.

Offline

 

#3 2010-11-01 17:04:41

jcorules
Scratcher
Registered: 2010-03-07
Posts: 8

Re: scoring variables

Great idea! Thanks!  smile   smile

Offline

 

Board footer