I'm making a pong game ( I know what you'll all say: ANOTHER PERSON MAKING PONG!?!?!?) but I can't find a way to make the ball bounce off the paddle. And I can't figure out how to make it so when the ball touches the floor below the paddle they lose.... any help?
Offline
Hi,
to make the ball bounce off the paddle, you have to put this script into the ball sprite:
<when green flag clicked>
<forever if><touching[ paddle
<point in direction( (( 180 <-> <direction> ))
<end>
<end>[/blocks]
And to make the 'floor', You'll have to make both ends have a colored bar behind the paddle. (make sure it's fairly big but not too distracting, otherwise any <if on edge, bounce>[/blocks] scripts you might have will activate before it can tell it's touching the end.) Both bars need to be different colors. Then to tell if it's touching the end, put in this script:
<when green flag clicked>
<forever>
<if><touching color[ player1's end
<change{ player2's score }by( 1
<end>
<if><touching color[ player2's end
<change{ player1's score }by( 1
<end>
<end>
It should work.
Offline
hmnwilson wrote:
Hi,
to make the ball bounce off the paddle, you have to put this script into the ball sprite:
<when green flag clicked>
<forever if><touching[ paddle
<point in direction( (( 180 <-> <direction> ))
<end>
<end>[/blocks]
And to make the 'floor', You'll have to make both ends have a colored bar behind the paddle. (make sure it's fairly big but not too distracting, otherwise any <if on edge, bounce>[/blocks] scripts you might have will activate before it can tell it's touching the end.) Both bars need to be different colors. Then to tell if it's touching the end, put in this script:
<when green flag clicked>
<forever>
<if><touching color[ player1's end
<change{ player2's score }by( 1
<end>
<if><touching color[ player2's end
<change{ player1's score }by( 1
<end>
<end>
It should work.
So do I make the colored bars on the paddle or on the floor behind the paddle? Also how do I make the ball glide forever?
Last edited by Zack2008 (2008-10-22 12:05:56)
Offline
Zack2008 wrote:
So do I make the colored bars on the paddle or on the floor behind the paddle? Also how do I make the ball glide forever?
You should make them on the floor behind the paddle, and you can make the ball go forever with
<when green flag clicked>
<forever>
<move( 10 )steps>
<end>
Offline
hola aguien hable español
miren esto es lo basico que pongo<forehttp://scratch.mit.edu/forums/viewtopic.php?id=10908#req_messagevehttp://scratch.mit.edu/forums/viewtopic.php?id=10908#req_messager if>http://scratch.mit.edu/forums/viewtopic.php?id=10908#req_messagehttp://scrhttp://scratch.mit.edu/forums/viewtopic.php?id=10908#req_messageatch.mit.edu/forums/viewtopic.php?id=10908#req_messagehttp://scratch.mit.edu/forums/viewtopic.php?id=10908#req_message
Offline
wewt i downloaded scratch
Offline