physics for a breakout game
I want to make a breakout clone. My question is what sort of physics should i use in the game. I have read posts saying that real physics of a breakout game is hard to do, well out of the clones i've played there doesnt seem to be real physics, DXball is a breakout clone and is great but there is'nt real physics in it, the way the ball bounces after it has hit something depends on where the ball hits the object and not on the angle it hits it. So can someone please tell me how i should implement the physics. Thanks in advance. Later.
Edited by - Chris F on 1/22/00 7:12:18 PM
"I have realised that maths can explain everything. How it can is unimportant, I want to know why." -Me
whenever the ball hits something have it go in the oppostite direction by multiplying its X and Y locotion by negative 1. this will make it go in the opposite direction like real physics because the angle of incidence equals the angle of reflection. In other words, at whatever angle it hits the object thats the angle its gonna bounce off on but in the opposite direction
If I only had a nickle for every problem I''ve had, I wouldn''t have anymore problems, but then I guess I wouldn''t have anymore nickles either...
If I only had a nickle for every problem I''ve had, I wouldn''t have anymore problems, but then I guess I wouldn''t have anymore nickles either...
If I only had a nickle for every problem I''ve had, I wouldn''t have anymore problems, but then I guess I wouldn''t have anymore nickles either...
Thanks. Yeah i do understand those physics concepts and that was how i intended to do it initialy but wont doing it that way cause the game to play bad because there would'nt be much variation in the way the ball bounces. Any other ideas please? Later.
Edited by - Chris F on 1/22/00 9:22:15 PM
Edited by - Chris F on 1/22/00 9:22:15 PM
"I have realised that maths can explain everything. How it can is unimportant, I want to know why." -Me
Ray745 was right to an extent, but you see there is more to it than that. When the ball hits walls or the centre of the bat it should bounce of in the same way as ray said, but, if for example the ball hits the edges of the bat or blocks it should either bounce of at a unpreditable direction or come straight back from where it came from, depending on the angle it came in on.
Hope that helped.
Spike
Hope that helped.
Spike
~SpikeYou can contact me at luke_howard@dingoblue.net.au
One possible idea to make a breakout game a bit more interesting would be to put a small amount of downward force (gravity) on the ball. This would make the angle constantly change, because when the ball went to different heights it would have different effects on the angle. You could also have a set of blocks that, when hit, change the amount of gravity (or remove it altogether) for a period of time. Of course, the downward force would have to be not so much that you can''t hit the top blocks, and it might make a few problems, such as the ball speeding up too much, or the ball getting to a point where it only bounces vertically. You''d have to take those sorts of things into account and design it so that those problems wouldn''t occur, if you were going to do it successfully.
Regards
Starfall
Regards
Starfall
Most breakout games actully had 5 differnt angles the ball would refract from. Just look at a book to the atari version(I know easier said than done lol). But basicly if it hits in the middle just reverse the x velocity ,otherwise depending on what part is hit tweak the y velocity.But one thing you have to watch out for is the ball moving to fast,and passing through the paddle or blocks.(I have this problem currently and for my best effort,and the help of others have not been able to get a working collision detection scheme that checks pixel by pixel of velocity moved.So that the ball could never go through the paddle or blocks.)
Zenroth,
For your collision detection scheme, I''m failing to see your problem. If you have your ball''s current position, you can calculate the ball''s next position using it''s velocity. Then, by using the line segment formed by the two points, check that line for intersection with the paddle and the blocks. If there''s an intersection, you can calculate the distance to the intersection and use the remainder as the distance after the bounce off.
For your collision detection scheme, I''m failing to see your problem. If you have your ball''s current position, you can calculate the ball''s next position using it''s velocity. Then, by using the line segment formed by the two points, check that line for intersection with the paddle and the blocks. If there''s an intersection, you can calculate the distance to the intersection and use the remainder as the distance after the bounce off.
Ya i know im doing that pretty much(Im drawing the line then moving through it pixel by pixel to know where and if a collision happens,but either my implementation is flawed or my collision detection itself is)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement