Speed change when ball & paddle collides in Breakout

Started by
4 comments, last by Mkk 20 years ago
Still working on my Breakout.. If I remember right, when ball hits paddle, ball´s angle changes and additionally it´s speed too. My question is: What kind of calculation is normally used to change the speed?
Advertisement
Still new in the game making scene, but I imagine you should increase the main variable depending on the angle. So if it would normaly be 2 x and 3 y (not this of course) then if its moving upward mainly make it 2x and 4y and if its horizontal movement then it starts at 3x and 2y and moves to 4x and 2y? Havn't done alot of angles... but something liek that + guess and check I imagine.

[edited by - RyoxSinfar on March 25, 2004 11:04:01 AM]
I jsut checked with a friend that made a pong game in java. Thou it was in java the thoery is the same. If you have a pause before the next redraw and position increment (or it would move at light speed) decrease the pause time. So it just increments alittle faster.

-This is where experience comes in handy (and I shoulda thought bout it more)
Hmm, just checked one breakout game type of game (Brickster) and it didn´t have any kind of speed increment (based on what location on the paddle ball hits) and it worked fine so I guess I will just do it that way..

Maybe I just remembered whole thing wrong

RyoxSinfair: Sorry but I didn´t really get what you are saying.. I don´t have any "pause time", my game´s speed is controlled so that everything is moved based on how fast computer can go one frame though..

Anyway, I guess I will just do it so that always when ball gets hit with the paddle, the speed will get increased by some default value.

Sorry, next time I will check the game first


[edited by - Mkk on March 25, 2004 2:20:20 PM]
Angle should change. Instead of treating the paddle as a flat paddle, treat it like a rounded one (I really need webspace for pictures :/)...

So make your paddle something like this... The angle changes depending on how far to left or right of centre the ball hits.
432101234
----0++++


So if ball hits paddle at far left, the ball angle reflects against, say, a 30 degree slanted angle, instead of against a horizontal surface.

Speed of ball could increase every time ball hits paddle, or perhaps as a function of time, but should not go over a maximum speed.
Ok, I explained myself little badly I guess, sorry for that.. Because I already have it so that angle changes between 10-170 when the ball hits the paddle..

And like I said in last post, ye I will increase ball´s speed with some def value.

It was just that I remembered that speed changes differently when ball hits different place in the paddle..

Have to admit that now I think it sounds little stupid :D


[edited by - Mkk on March 25, 2004 6:22:13 PM]

This topic is closed to new replies.

Advertisement