development #8
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user