I'm trying to make a paddle game but whenever I try hitting the ball, it just goes right through the paddle! This is my script for the ball, if that will help you.
[blocks]<when green flag clicked>
<forever if>touching Computer?
<point in direction( 90-direction)
<move( 7 )steps>
<turn (pick random -20- 20 )degrees>
<end>
[/blocks]
The Player is the same.
Offline
I think that 90-direction should be direction*-1 (assuming it is left to right and not top to bottom pong). I don't think that'll fix it though... The script I use is:
<when green flag clicked>
<forever>
<if><< <touching[ paddle1 ]> <or> <touching[ paddle2 ]> >>
<point towards( (( <direction> <*> -1 ))>
<end>
<if><< <touching[ upperedge ]> <or> <touching[ loweredge ]> >>
<point in direction( (direction *(180-abs of (direction)))/abs of (direction) )>
<end>
<move( 2 )steps>
Offline
MoreGamesNow wrote:
I think that 90-direction should be direction*-1 (assuming it is left to right and not top to bottom pong). I don't think that'll fix it though... The script I use is:
<when green flag clicked>
<forever>
<if><< <touching[ paddle1 ]> <or> <touching[ paddle2 ]> >>
<point towards( (( <direction> <*> -1 ))>
<end>
<if><< <touching[ upperedge ]> <or> <touching[ loweredge ]> >>
<point in direction( (direction *(180-abs of (direction)))/abs of (direction) )>
<end>
<move( 2 )steps>
Wait there's a block called upperedge or loweredge
Offline
Robot_Maniac wrote:
MoreGamesNow wrote:
I think that 90-direction should be direction*-1 (assuming it is left to right and not top to bottom pong). I don't think that'll fix it though... The script I use is:
[blocks]
<when green flag clicked>
<forever>
<if><< <touching[ paddle1 ]> <or> <touching[ paddle2 ]> >>
<point towards( (( <direction> <*> -1 ))>
<end>
<if><< <touching[ upperedge ]> <or> <touching[ loweredge ]> >>
<point in direction( (direction *(180-abs of (direction)))/abs of (direction) )>
<end>
<move( 2 )steps>
[/blocks]Wait there's a block called upperedge or loweredge
He's talking about the upper/lower edge sprites. Just use whatever you called them.
Offline