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

#1 2010-11-15 01:12:30

watashiiswatashi
New Scratcher
Registered: 2010-11-14
Posts: 1

Impassable walls like maze

how do i make an impassable wall like a maze?

thanks.


watashi

Offline

 

#2 2010-11-15 15:35:53

colorfusion
Scratcher
Registered: 2009-10-03
Posts: 500+

Re: Impassable walls like maze

There are many ways, depending on how the sprite moves, what perspective the game is at and many more things, there is not really a single way to do it however the easiest way to do it is make it move back some steps when it is touching the colour of the wall, if you use changing the direction to move.
If not the easiest way is probably to check if it is touching the colour just as it moves, if it is it moves back depending on which way it just moved.

Offline

 

#3 2010-11-15 17:10:39

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Impassable walls like maze

colorfusion wrote:

There are many ways, depending on how the sprite moves, what perspective the game is at and many more things, there is not really a single way to do it however the easiest way to do it is make it move back some steps when it is touching the colour of the wall, if you use changing the direction to move.
If not the easiest way is probably to check if it is touching the colour just as it moves, if it is it moves back depending on which way it just moved.

Like this:

Code:

When green flag clicked
Forever if touching color black
   move -3 steps
End Forever

http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#4 2010-11-16 00:26:21

2l84zwamani
Scratcher
Registered: 2010-09-27
Posts: 100+

Re: Impassable walls like maze

For a maze, you MAY have to use this script, because sometimes you just make it change x and change y. If you use if right arrow clicked point in direction 0, move 10 steps, then you can use the script mentioned above.

When flag clicked
Forever
If touching colour impassablewallcolour
  point in direction ( direction - 180 )
  move 3 steps
EndIf
EndForever


I will be a Ms. Pickle Dr. Deadpebble Great Person <forever>
http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3 GROB THE SLIME WILL TAKE OVER THE WORLD!

Offline

 

#5 2010-11-16 21:28:52

-GizzardGulp-
Scratcher
Registered: 2010-03-05
Posts: 100+

Re: Impassable walls like maze

Here is what I use, just replace the first colors with the colors of each side of the sprite (corresponding with up, left, right, and down) and replace the second color with the "impenetrable" wall. Then replace "2" with the speed you want your sprite to go.

http://i1118.photobucket.com/albums/k607/Max_Levine/bob.gif

that way works better than

colorfusion wrote:

There are many ways, depending on how the sprite moves, what perspective the game is at and many more things, there is not really a single way to do it however the easiest way to do it is make it move back some steps when it is touching the colour of the wall, if you use changing the direction to move.
If not the easiest way is probably to check if it is touching the colour just as it moves, if it is it moves back depending on which way it just moved.

because it doesn't make the sprite jitter and usually doesn't come out with any glitches and when it does, it just means you painted the sides of the sprite incorrectly.

I hope I helped!

Last edited by -GizzardGulp- (2010-11-17 06:53:13)


http://i1118.photobucket.com/albums/k607/Max_Levine/SnoutmolStudios.png

Offline

 

#6 2010-11-19 11:27:01

-GizzardGulp-
Scratcher
Registered: 2010-03-05
Posts: 100+

Re: Impassable walls like maze

honk!


http://i1118.photobucket.com/albums/k607/Max_Levine/SnoutmolStudios.png

Offline

 

Board footer