amethyst/evoli

Initial collision system

marotili opened this issue · 1 comments

A quick solution should be implemented until a real collision system exists. For now we consider entities to have a circle as their bounds.

The collision system should:

  1. Calculate (based on radius) what entities intersect each other
  2. If entities intersect, a repelling force is applied so that the entities move away from each other. The repelling force is inversely proportional to the distance between the entities.
  3. An entity in conflict can't move so that the distance to any of the conflict partner decreases.
  4. A collision start event will be dispatched when a collision starts
  5. A collision end event will be dispatched when the collision ends
  6. The spawning should be modified so that there are no conflicts at start

The combat system should be aware of the whole duration of the collision, since attacks are performed every second as long as there is a conflict. Because of that the collision events are split into start and stop events.
Another approach would be to send a collision event every iteration.

The point 3. exists in case an entity collides with two other entities at the same time along one vector, to avoid jittering.

Completed in #18