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 gf clicked
forever
if <[sprite v] touching colour [000000]//colour of wall, or if wall is a sprite, use "if sprite touching wall" block
go to [beginning]
end
end
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 gf clicked
forever
if <[sprite v] touching colour [000000]>
broadcast [game over v]
end
end
when I receive [game over v]
do action
Starting new level:
when gf clicked
set [level v] to [1]
forever
if <[sprite v] touching [finish]>
change [level v] by [1]
end
end
Hide sprites (if you want them to be shown on only one of the levels):
when gf clicked
forever
if <level = 1>// whatever level you want the sprite to be shown at
show
else
hide
end
end
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 flag clicked
forever if <touching color [#000000]?>
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 v]>
go to [beginning v]
change [level v] by [1]
end
this will make sure that the level doesn't get changed by more than 1


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

Offline

 

Board footer