AI-Project/survival/systems/draw_system.py

14 lines
471 B
Python
Raw Normal View History

2021-03-28 18:05:52 +02:00
from survival import esper
from survival.components.position_component import PositionComponent
from survival.components.sprite_component import SpriteComponent
class DrawSystem(esper.Processor):
2021-03-28 18:42:04 +02:00
def __init__(self, camera):
2021-03-28 18:05:52 +02:00
self.camera = camera
def process(self, dt):
for ent, (sprite, pos) in self.world.get_components(SpriteComponent, PositionComponent):
sprite.image.pos = pos.position
self.camera.draw(sprite.image)