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

#1 2011-11-19 12:19:59

GameHutSoftware
Scratcher
Registered: 2010-04-24
Posts: 1000+

Bouncing

I need help bouncing a ball off the side a a Pool Table for a game I'm making. Whenever I use
[blocks]
<point in direction( (( 180 <-> <direction> )) )
[/blocks]
it messes up! Please help.


Lurking more than posting, but still here.

Offline

 

#2 2011-11-19 12:30:47

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Bouncing

When it bounces off the cushion on the left or right side of the screen, put:

Point in direction (direction*-1)

Then for the top or bottom cushion:

Point in direction (180-direction)

I think that should work!  smile


Why

Offline

 

#3 2011-11-19 12:35:46

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Bouncing

What you're doing there is telling it turn completely around.  You need a different formula and it's easiest to do that with x and y velocities instead of direction.  Here's what I would do:

http://i42.tinypic.com/8wjrph.gif


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

Board footer