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 self.map = game_map
def process(self, dt): 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: if moving.target is not None:
continue continue
@ -24,8 +25,8 @@ class CollisionSystem(esper.Processor):
if self.check_collision(moving.target): if self.check_collision(moving.target):
self.world.remove_component(ent, MovingComponent) self.world.remove_component(ent, MovingComponent)
onCol.callAll() onCol.callAll()
colliding_object : int = self.map.get_entity(moving.target) 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() self.world.component_for_entity(colliding_object, OnCollisionComponent).callAll()
else: else: