There's a few methods
Colour Recognition, Hit Tests etc:
The easiest method is this though:
<when green flag clicked>
<if><key[ Right ]pressed?>
<move( 1,2,3 etc: )steps>
<if><touching color[ Black (Or the colour of your walls)
<move( -1,2,3 etc: )steps>
<end>
And then just repeat that for all directions
Last edited by 06dknibbs (2010-05-25 08:54:47)
Offline
06dknibbs wrote:
There's a few methods
![]()
Colour Recognition, Hit Tests etc:
The easiest method is this though:
[blocks]
<when green flag clicked>
<if><key[ Right ]pressed?>
<move( 1,2,3 etc: )steps>
<if><touching color[ Black (Or the colour of your walls)
<move( -1,2,3 etc: )steps>
<end>
[/blocks]
And then just repeat that for all directions![]()
I would replace [blocks]<touching color[ Black[blocks]
with [blocks]<touching[ wall[/blocks].
Offline
meew0 wrote:
06dknibbs wrote:
There's a few methods
![]()
Colour Recognition, Hit Tests etc:
The easiest method is this though:
[blocks]
<when green flag clicked>
<if><key[ Right ]pressed?>
<move( 1,2,3 etc: )steps>
<if><touching color[ Black (Or the colour of your walls)
<move( -1,2,3 etc: )steps>
<end>
[/blocks]
And then just repeat that for all directions![]()
I would replace [blocks]<touching color[ Black[blocks]
with [blocks]<touching[ wall[/blocks].
Sprite's work too xD
Although it depends on the project..
Project with a lot of sprites: Use a wall sprite = Easier
Project with 2 - 3 sprites: Probably simpler to use a colour etc:
*Goes to look for a guide..*
Edit: http://scratch.mit.edu/projects/fireball123/940816/
^ I can't view projects on school computers at the moment, but it sounds like it might help.
Last edited by 06dknibbs (2010-05-25 09:00:24)
Offline