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
<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
That works!!! Thanks alot!!!
Offline
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.
Offline