General Physics Question
i have several games i''ve never brought through to completion, so just for a bang (and for a new change of pace) i''m writing a silly little breakout style game.
i''m used to creating tile games where physics is not an issue, and it has been some time since i was in school taking physics.
Question: how can one determine the physics of the ball''s motion? i.e. when it hits a wall, how to reflect it properly. i have some idea of how this might work, but i''m sure there are tested, tried, and true methods out there for this type of thing. Any advice is appreciated.
"You call him Dr. Grip, doll!"
"You call him Dr. Grip, doll!"
June 06, 2001 09:41 AM
how about this?
if ball hit from above or under
ball.velocity.y = -ball.velocity.y
if ball hit from left or right
ball.velocity.x = -ball.velocity.x
if ball hit from above or under
ball.velocity.y = -ball.velocity.y
if ball hit from left or right
ball.velocity.x = -ball.velocity.x
That sounds good, but don''t i need to track the ball''s position? Or should i determine that from the velocity (if so, how exactly?)? Thanks!
"You call him Dr. Grip, doll!"
"You call him Dr. Grip, doll!"
"You call him Dr. Grip, doll!"
|
Then set a default value for each velocity, then all you do is reverse it''s property (I dunno a word for this) from negative to positive.
Check my site, I got a clone of breakout that you can download and play with. I can send you the semi messy source so you can learn from it.
------------------------------
"I''m a decorated astronaut, I don''t make those kind of mistakes."
"Oh now wait a minute. Look I''ll show ya. I''ll enter the same calculations using what we like to call ''The Right Way''."
-Rem
Zirem Software
------------------------------"I'm a decorated astronaut, I don't make those kind of mistakes.""Oh now wait a minute. Look I'll show ya. I'll enter the same calculations using what we like to call 'The Right Way'."-RemZirem Software
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement