Sign in to follow this  
Rhaal

Arkanoid Clone - Controlling Speed

Recommended Posts

I'm curious as to the methods used for controlling the speed of a ball in an Arkanoid/breakout clone. I notice in these games the ball usually moves faster if you bank it off the sides of the paddle. In my game the paddle is 100px wide, so I have 3 bounding boxes: [ 20 | 40 | 20 ] If the ball hits the left or right one, I increase the x speed and change the y direction. If it hits the middle, I simply reverse the x and y directions. Now for what I'm trying to do. I tried a method that slightly decreased the x speed, but the problem came if there were too many consecutive middle hits - it'd get too slow. Help from anyone whos made a clone like this would help. Should I just put a cap on the speed and not decrease it? Should I have it decrease slightly for "good things" like the player hitting bricks?

Share this post


Link to post
Share on other sites
Have the speed decrease towards a limit if you hit the middle, and increase towards a limit if you hit the sides.

You can accomplish this by taking a weighted average of the current speed with whichever limit is appropriate according to where the ball was hit.

Share this post


Link to post
Share on other sites
Hey that worked out quite well thanks! What I do now is increase the x speed on the left and right, and in the middle I increase the y speed and decrease the x speed. I also have it check min and max values so the ball doesn't stop or get too wild. It actually feels right :D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this