This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-10-21 20:46:02

Zack2008
Scratcher
Registered: 2008-10-21
Posts: 5

Making sprites edges

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

 

#2 2008-10-21 23:32:55

hmnwilson
Scratcher
Registered: 2007-07-04
Posts: 1000+

Re: Making sprites edges

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.


I'm taking a break from Scratch until 2.0 comes out. Any messages sent between then and now probably won't be read - sorry.
(Oct. 20, 2011)

Offline

 

#3 2008-10-22 10:50:05

Zack2008
Scratcher
Registered: 2008-10-21
Posts: 5

Re: Making sprites edges

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

 

#4 2008-10-22 19:55:20

hmnwilson
Scratcher
Registered: 2007-07-04
Posts: 1000+

Re: Making sprites edges

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>


I'm taking a break from Scratch until 2.0 comes out. Any messages sent between then and now probably won't be read - sorry.
(Oct. 20, 2011)

Offline

 

#5 2008-10-22 23:32:38

hazael222
Scratcher
Registered: 2008-10-22
Posts: 1

Re: Making sprites edges

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

 

#6 2008-11-01 11:39:33

darkhelmit4
Scratcher
Registered: 2008-11-01
Posts: 2

Re: Making sprites edges

wewt  i downloaded scratch  smile

Offline

 

Board footer