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

#1 2012-08-28 11:24:57

Pfctink
Scratcher
Registered: 2012-08-28
Posts: 22

Broken PONG script, need help.

So I decided to make PONG as a fun project for two people to play on one computer, but I can't get the physics down to where if the ball hits the player sprite at a certain angle, then it'll go up or down at a certain angle.

http://scratch.mit.edu/projects/Pfctink/2748235

(I'm looking to redo that bounce-back script/physics entirely)

Offline

 

#2 2012-08-28 21:16:58

dvd4
Scratcher
Registered: 2010-06-30
Posts: 1000+

Re: Broken PONG script, need help.

angle of approach = angle of reflection (basic physics)


I made a mod  big_smile  It's called blook!
http://i49.tinypic.com/16ia63p.png

Offline

 

#3 2012-08-28 21:34:32

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: Broken PONG script, need help.

assuming the bat is verticle

when gf clicked
forever
if <touching [bat v]?>
point in direction ((direction) * (-1))


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#4 2012-08-28 23:43:26

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Broken PONG script, need help.

^^ This.  If the "bat" were horizontal, it would be 180 - direction.

Offline

 

Board footer