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

#1 2010-08-09 20:32:52

tikktokk
Scratcher
Registered: 2009-08-21
Posts: 30

Fix bounce glitch

In my pong game if you got a wrong angel and hit one of the boxes in the middle it bounce of wrong i'll try to drawe it:

.=nothing   / and \=direction of ball   [.]=box   O = ball

O
..\
...\
..[.]  <-- WRONG
../
./

........[.]
......../\
......./..\     <-- CORRECT
....../....\
...../.....O

This glitch dosent always happens but since I want a perfect game I need to fix it! Please help


Vigenère cipher, the unbreakable code system! so strong not even the strongest computer can break it! you can mail people secrets you dont want other to know! and all this here!

Offline

 

#2 2010-08-09 21:29:06

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

Re: Fix bounce glitch

Instead of usingdirection, use x and y values.  When it's touching the box on the side, multply the x by -1, and when touxhing top or bottom, y times-1.


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

Offline

 

#3 2010-08-11 12:39:26

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Fix bounce glitch

I made a project that does bouncing like that. But it uses a laser instead of a ball, but I'm sure that will some adaptation you may be able to use the bouncing script. http://scratch.mit.edu/projects/MoreGamesNow/755062


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer