Exemplo n.º 1
0
class User(object):
    def __init__(self):
        self.rectangle = Rectangle(Vector2D(0,0),Vector2D(1000,1000))
        self.lastUpdateEntities = []
    def updateEntitiesInViewport(self, entities):
        updateEntities = []
        for entity in entities:
            if self.rectangle.covers(entity.position,entity.length):
                updateEntities.append(entity)
        for lastEntity in self.lastUpdateEntities:
            if not updateEntities.__contains__(lastEntity):
                self.deactivateEntity(lastEntity)
        for entity in updateEntities:
            if not self.lastUpdateEntities.__contains__(entity):
                self.activateEntity(entity)
            else:
                self.updateEntity(entity)
        self.lastUpdateEntities = updateEntities
    def updateEntity(self, entity):
        pass
    def deactivateEntity(self,entity):
        pass
    def activateEntity(self,entity):
        pass
Exemplo n.º 2
0
 def __init__(self):
     self.rectangle = Rectangle(Vector2D(0,0),Vector2D(1000,1000))
     self.lastUpdateEntities = []