This site requires JavaScript, please enable it in your browser!
Greenfoot back
GreenGoo
GreenGoo wrote ...

2013/3/24

Missile Swerving

GreenGoo GreenGoo

2013/3/24

#
I have made a game where missiles spawn randomly and chase the mouse cursor. However, I want them to swerve away from each other if they come too close. How could I do this?
GreenGoo GreenGoo

2013/3/24

#
Anyone? I really need some help on this!
danpost danpost

2013/3/24

#
No traffic control system is perfect. Even controlling the interaction between two vehicles involves not just the state of the two being close to each other, but determining how they are approaching each other and turning the correct way to avoid each other takes a bit of Maths. When a third vehicle is introduced into the equation, things really get complicated. Basically, what I am saying is that this is probably not anything a beginner should try to tackle. You could, however, randomly choose a direction and begin turning that way until either a collision occurs or the two vehicle have cleared each other. Then have them resume chasing the mouse.
You need to login to post a reply.