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

#1 2009-08-13 18:05:47

thedefenderofdeath
Scratcher
Registered: 2009-08-13
Posts: 10

help! how do you create a wall

sorry im new with scratch and i need to know how to stop a character from walking through a wall.

ive tried;     (when space is pressed)    (if touching sprite (wall))     (move -5 steps)
and;      (when space is pressed)    (move 5 spaces )  ( reapeate until )     (touching sprite (wall))

neather of them worked can you help me plz.

Offline

 

#2 2009-08-13 18:16:35

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: help! how do you create a wall

<when green flag clicked>
<forever>
<if><key[ space ]pressed?>
<if><touching[ wall
<move( -5 )steps>
<else>
<move( 5 )steps>
<end>
<end>

hope that helps

Offline

 

#3 2009-08-14 08:52:59

thedefenderofdeath
Scratcher
Registered: 2009-08-13
Posts: 10

Re: help! how do you create a wall

That works!!!    Thanks alot!!!

Offline

 

#4 2009-08-14 14:21:27

WeirdF
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: help! how do you create a wall

Or you could make 2 sprites, one is named Wall Right and one is Wall Left. You could make it so that when you are pressing the right arrow key and you are not touching Wall Right, then you move. Then do the same for the Wall left.

You could make it so that the wall on the right is a slightly different colour to the floor, and the wall on the left is also slightly different. Then you could make it so that when you are not touching the colour of the wall on the right, you can move. Then do the same fro the other colour for the other wall.

I hope I made myself clear.


http://i.cr3ation.co.uk/dl/s1/gif/847032b8a331def77529b6a0384db1fe_handfingers.gif

Offline

 

Board footer