Pages: 1
Topic closed
No help from me.
OT: I like your username.
Offline
rdococ wrote:
No help from me.
OT: I like your username.
Please keep the posts on topic...and if you can't help personally, maybe you can recommend somebody else who can
To keep players from going through walls, there are a number of different techniques used. I've seen some that have separate tests for each direction and reverse the move if the player is touching a wall. Something like this...
[blocks]
<when green flag clicked>
<forever>
<if><key[ Right Arrow ]pressed?>
<point in direction( 90
<move( 5 )steps>
<if><touching color[ black
<move( -5 )steps>
<end>
<end>
<if><key[ Left Arrow ]pressed?>
<point in direction( -90
<move( 5 )steps>
<if><touching color[ black
<move( -5 )steps>
<end>
<end>
--- Similar blocks here for Up and Down ---
<end>
[/blocks]
A technique I like uses a couple of variables to remember where the last position that wasn't touching a wall was and returns to that whenever the wall is touched. You can see that here
http://scratch.mit.edu/projects/Paddle2SeeFixIt/188825
hope that helps!
Offline
Paddle2See wrote:
rdococ wrote:
No help from me.
OT: I like your username.Please keep the posts on topic...and if you can't help personally, maybe you can recommend somebody else who can
![]()
To keep players from going through walls, there are a number of different techniques used. I've seen some that have separate tests for each direction and reverse the move if the player is touching a wall. Something like this...
[blocks]
<when green flag clicked>
<forever>
<if><key[ Right Arrow ]pressed?>
<point in direction( 90
<move( 5 )steps>
<if><touching color[ black
<move( -5 )steps>
<end>
<end>
<if><key[ Left Arrow ]pressed?>
<point in direction( -90
<move( 5 )steps>
<if><touching color[ black
<move( -5 )steps>
<end>
<end>
--- Similar blocks here for Up and Down ---
<end>
[/blocks]
A technique I like uses a couple of variables to remember where the last position that wasn't touching a wall was and returns to that whenever the wall is touched. You can see that here
http://scratch.mit.edu/projects/Paddle2SeeFixIt/188825
hope that helps!
That should work.
Offline
Topic closed
Pages: 1