pkulev / xoinvader

Python space game in terminal
http://mmap.me
MIT License
12 stars 1 forks source link

Collision detection #19

Closed pkulev closed 7 years ago

pkulev commented 8 years ago
class ERocketLauncher(Weapon):
    super(ERocketLauncher, self).__init__(**CONFIG[self.type])
    self._collider = SphereCollider(pos=Vec3(0, 0), radius=1)
    ...

Further collision detection code will be moved into engine and colliders will turn into components for lightweight entities.

Collision detection tightly coupled with event system and object system.

alex-eg commented 7 years ago
>    self._collider = SphereCollider(pos=Vec3(0, 0), radius=1)

And right after this, on next update the object should already check for collisions with other objects, right? @pkulev

pkulev commented 7 years ago

Yes. All collisions should check on events stage of iteration, on update stage game objects should know that collision detected and where.

alex-eg commented 7 years ago

What is event stage? I'm afraid we don't quite have it.

pkulev commented 7 years ago

Please consider with State class.

Application calls 3 functions of current state.

events()
update()
render()