development #8

Merged
s452701 merged 6 commits from development into master 2021-05-24 13:20:01 +02:00
Showing only changes of commit fe9a13f67a - Show all commits

View File

@ -12,7 +12,8 @@ class CollisionSystem(esper.Processor):
self.map = game_map
def process(self, dt):
for ent, (pos, moving, onCol) in self.world.get_components(PositionComponent, MovingComponent, OnCollisionComponent):
for ent, (pos, moving, onCol) in self.world.get_components(PositionComponent, MovingComponent,
OnCollisionComponent):
if moving.target is not None:
continue
@ -25,7 +26,7 @@ class CollisionSystem(esper.Processor):
self.world.remove_component(ent, MovingComponent)
onCol.callAll()
colliding_object: int = self.map.get_entity(moving.target)
if self.world.has_component(colliding_object, OnCollisionComponent):
if colliding_object is not None and self.world.has_component(colliding_object, OnCollisionComponent):
self.world.component_for_entity(colliding_object, OnCollisionComponent).callAll()
else: