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

#1 2007-12-05 14:58:39

shaltry_c
Scratcher
Registered: 2007-11-13
Posts: 1

Simple level script

Does anyone have a simple script for changing the "level" of a player after an action has been performed, say hitting a ball x # of times or moving to the side of the screen??  Please help.

Offline

 

#2 2007-12-05 15:37:39

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Simple level script

If you have a variable called "level", then "change level by 1" would do it.
What exactly do you want to have happen?  That seems to be very game-dependent, so can't be handled by a generic script.

Offline

 

#3 2007-12-05 19:34:32

funkymonkey
Scratcher
Registered: 2007-06-03
Posts: 1000+

Re: Simple level script

[blocks]
<forever>
<if><touching[ egde
<change{ level }by( 1
<end>

AND

<forever>
<if> <touching[ ball
<change{ amount of times sprite1 hit the ball }by( 1

<forever>
<wait until> <( <{ amount of times sprite1 hit the ball }> <=> 10 )>
<change{ level }by( 1
[/blocks]

something like that i think. i dont know if it even works, but you can try it.

Last edited by funkymonkey (2007-12-05 19:48:43)


http://i243.photobucket.com/albums/ff67/hprules_photos/banner2.jpg
Kuzimu: Dawn of a New Age                                                                                                  Coming May 2010

Offline

 

#4 2007-12-05 20:04:36

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Simple level script

funkymonkey,
your scripts will cause the levels to go shooting up as soon as the condition is met.

You probably need another wait in your forever loops

forever
      wait until touching edge
     change level by 1
      wait until not touching edge

forever
    wait until touching ball
    change ball_touched by 1
   wait until not touching ball


forever
    wait until ball_touched > 9
   change level by 1
   set ball_touched to 0

Offline

 

Board footer