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

#1 2012-10-15 07:11:41

nico229
New Scratcher
Registered: 2012-10-15
Posts: 5

Bounce does not work properly

I am making a simple brick breaker game.  However, I cannot get bounce to work properly.  The ball sometimes goes right through the brick and other times seems to bounce inside the brick.  What is the problem?

Offline

 

#2 2012-10-15 08:43:23

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Bounce does not work properly

Getting a good bounce script is harder than most people realize!  You need to sense when the ball hits the object and stop it moving, then you need to compute the new direction, point it in that direction, and get it moving without accidentally triggering another bounce until it has cleared the stationary object.  Once it has cleared, you want the sensing for stationary objects to turn back on.

Can you provide a link to your current project?  It's often easier for folks to see what you have so far.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2012-10-15 08:56:02

nico229
New Scratcher
Registered: 2012-10-15
Posts: 5

Re: Bounce does not work properly

I have uploaded the project to my stuff.  How do I provide a link?

Offline

 

#4 2012-10-15 09:06:32

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Bounce does not work properly

Open up the project and copy the address in the address bar. Then paste it here.  wink  If you want a clickable blue link, you need to paste the address in between [url] and[/url], e.g. [url]www.google.com[/url].


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#5 2012-10-15 09:08:45

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Bounce does not work properly

Your bounce engine actually looks quite nice, but isn't too accurate. Since you're just bouncing off a horizontal platform, simply negating the direction should work:

point in direction ((direction)*(-1))


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#6 2012-10-15 09:26:48

nico229
New Scratcher
Registered: 2012-10-15
Posts: 5

Re: Bounce does not work properly

Thanks for the help.  This seems to have fixed my bounce problem.  I still have the ball passing through scripts (both bricks and paddle at the bottom).  Any suggestions?

Offline

 

#7 2012-10-15 09:29:54

nico229
New Scratcher
Registered: 2012-10-15
Posts: 5

Re: Bounce does not work properly

here is project address.      http://scratch.mit.edu/projects/nico229/2836725

Offline

 

#8 2012-10-15 09:49:27

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Bounce does not work properly

You should move the ball slower. Chances are, your ball is moving so fast, it skips the bricks entirely between frames. Instead of moving 10 units every 1 second, try moving 5 units every half second.  wink


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#9 2012-10-15 09:57:34

nico229
New Scratcher
Registered: 2012-10-15
Posts: 5

Re: Bounce does not work properly

Thanks.  I will try that.

Offline

 

#10 2012-10-15 10:03:28

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Bounce does not work properly

Good luck!


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

Board footer