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

#1 2011-06-14 01:33:52

wglass
New Scratcher
Registered: 2011-06-14
Posts: 1

Speeding up a bounce

Hi,

I made a simple breakout style game:

http://scratch.mit.edu/projects/wglass/1858994

My concern is that when the ball bounces off the paddle, there's a noticeable delay.  When I play with the downloadable scratch app there's no delay, but on the web site it pauses for a moment.  How can I make this go without a delay?

The script to bounce is in the ball.  The paddle is 5 sprites stringed together.  The ball has a "forever" loop with an if statement for each section of the paddle.  If it hits the top, it bounces at an up angle.  If it hits the middle, it bounces straight.  If it hits the bottom, it bounces at a down angle.  It also plays a "laser" sound when it bounces.

WILL

P.S.  My first game.  Downloaded for my son to play with but ended up spending a couple hours in the evening making this after he went to bed!  Very nice.

Offline

 

#2 2011-06-14 03:00:09

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

Re: Speeding up a bounce

hm...it's an interesting problem, but I can't actually look at the project right now.  If I could, I could tell you how to minimize your number of sprites, which might speed up that process.


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

Offline

 

#3 2011-06-14 05:21:51

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Speeding up a bounce

My guess is that the decreased performance of the online player is causing some lag when it takes a while to perform the necessary calculations. Maybe if you found a more streamlined way of doing it, such as making the paddle one sprite and calculating the angle of the bounce based on the ball's position relative to the center of the paddle?


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

Board footer