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

#1 2012-04-15 09:27:14

browneyedgirl
New Scratcher
Registered: 2012-04-15
Posts: 1

Help With Maze Game

I'm trying to create a maze game but I really want to know how to:

- End the game when my sprite touches the wall
- Hide sprites from one background
- Start a new level

Please help! :(

Offline

 

#2 2012-04-15 11:21:16

PhirripSyrrip
Scratcher
Registered: 2012-02-11
Posts: 100+

Re: Help With Maze Game

How about this?
End game:

when clicked
forever
if
colour of wall, or if wall is a sprite, use "if sprite touching wall" block
go to
beginning

that will reset the sprite to the beginning of the game. If you want a proper "game over" screen to come up, do this instead:
when clicked
forever
if
sprite
touching colour
000000
broadcast
game over
when I receive
game over
do action

Starting new level:
when clicked
set
level
to
1
forever
if
sprite
touching
finish
change
level
by
1

Hide sprites (if you want them to be shown on only one of the levels):
when clicked
forever
if
level = 1
whatever level you want the sprite to be shown at
show
else
hide

if I got something wrong, misunderstood you or if you have any questions, ask  smile


http://i46.tinypic.com/ao03lk.png

Offline

 

#3 2012-04-15 11:25:47

gettysburg11
Scratcher
Registered: 2008-06-14
Posts: 1000+

Re: Help With Maze Game

To end the game when your sprite touches the wall, put this script on it. Just change black to whatever color your walls are if they aren't black already.

when clicked
forever if
touching color
?
stop all

Last edited by gettysburg11 (2012-04-15 11:26:16)


http://i256.photobucket.com/albums/hh184/mnacmilan/LOGO_ACMILAN-Splash.gif

Offline

 

#4 2012-04-15 11:28:51

PhirripSyrrip
Scratcher
Registered: 2012-02-11
Posts: 100+

Re: Help With Maze Game

sorry, colour 000000 was meant to be black  hmm

also, on the starting new level one, i should have written

if
sprite
touching
finish
go to
beginning
change
level
by
1

this will make sure that the level doesn't get changed by more than 1


http://i46.tinypic.com/ao03lk.png

Offline

 

Board footer