Keeping distance

Posted By: Realspawn

Keeping distance - 03/20/17 12:43

I have astroids in my game that use the same pointer what would
be the best way so they always stay on a certain distance from
each other ?

Thank you for your time laugh
Posted By: Reconnoiter

Re: Keeping distance - 03/20/17 13:34

How do you move your asteroids?
If you move them through e.g. c_move, you can just increase the bounding box your asteroids (scale than c_setminmax than shrink to original size , or just vec_scale min_x and max_x manually). Also setting the GLIDE flag in your c_move function helps (also take a look at move_friction in the manual).

A better way perhaps would be adding a EVENT_IMPACT to your asteroids that when they make contact with each other (e.g. through c_move) they move away from each other (just compare the positions of both asteroids to calculate the velocity you want and e.g. save these in the asteriods' skills and than in the asteroid's c_move use these skill values).

Another way but maybe overkill solution would be implementing a flocking system.

Posted By: Realspawn

Re: Keeping distance - 03/20/17 15:06

There not moving but appear at random places
that impact sounds like a solution i will toy with it some more.
i fixed the issue thx for pointing me in the right direction laugh

© 2024 lite-C Forums