Idiot (Me) can't figure out collisions
Hi,
I'm new here. I have a collision problem I haven't been able to figure out.
First off all, I'm using a open-source program called Construct, it's kind of like Game Maker. So it's not a language.
My game is a top-down spaceship game, and I have the movement laid out:
Each ship has these variables:
Mass (is set at 300)
MovSpeed = How much push the engines are giving
XPos = X Position
YPos = Y Position
XMov = The movement from the engines along the X plane
YMov = The movement from the engines along the Y plane
XMovEx = The movement from external forces along the X plane
YMovEx = The movement from external forces along the Y plane
The ship moves by this:
SET Ship.Value('XMov') to Ship.Value('XMov')+((Cos(Ship.Angle)*Ship.Value('MovSpeed')/Ship.Value('Mass'))*TimeDelta)
SET Ship.Value('YMov') to Ship.Value('YMov')+((sin(Ship.Angle)*Ship.Value('MovSpeed')/Ship.Value('Mass'))*TimeDelta)
then
SET Ship.Value('XPos') to Ship.Value('XPos')+(Ship.Value('XMov')*TimeDelta)+(Ship.Value('XMovEx')*TimeDelta)
SET Ship.Value('YPos') to Ship.Value('YPos')+(Ship.Value('YMov')*TimeDelta)+(Ship.Value('YMovEx')*TimeDelta)
Now all this works fine. I just can't for the life of me fingure out how to make the ship bounce when it collides with an opposing ship. I hope I'm not rambling.
Can anybody help me? If you can, please be easy on me.
YetAnotherSuperhero
http://en.wikipedia.org/wiki/Inelastic_collision
http://en.wikipedia.org/wiki/Elastic_collision
http://en.wikipedia.org/wiki/Coefficient_of_restitution
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement