Hi, lets say i have about a hundred enemy objects bouncing around in my frame.
How would i make sure the objects 'never' overlap eachother?
Printable View
Hi, lets say i have about a hundred enemy objects bouncing around in my frame.
How would i make sure the objects 'never' overlap eachother?
What do you mean? If you want them to deflect each other when they hit, you can do:
If you want them to turn away from each other to avoid ever hitting, then it's sort of impossible because with 100 objects, there would probably not be room to do that.Code:Enemy collides with Enemy:
---Enemy: Bounce
Hmm
I used this method making moving objects (or just objects) NEVER get stuck in walls...
I did this by storing their X and Y in Xmemory_ and Ymemory_ when NOT overlapping a backdrop. Then, as son as they did overlap a backdrop, they would just reposition to their X and Y memory_
I tried applying the same to enemy objects bouncing around, but it didnt seem to work.
Now im just curious as to how other people have solved this proble, so it may give me an idea or solution.
I went over an old post, and read something about TimerBasedMovement, maybe that could be relevant? idk
Nevertheless i would like to hear how others have addressed the issue of enemy collisions
Well, you could try and find the agnle between the overlapping enemies and move them away from eachother with a 360 degrees movement. Of course this would be pretty complicatd and it's probably better to just use the boucne action.