Ejemplo n.º 1
0
class PlayerObject(Object):
    def __init__(self, parent, content, screen):
        Object.__init__(self, parent, content, screen)

        self.x = 2
        self.y = 2
        self.speed = 5
        self.moveUp = False
        self.moveDown = False
        self.moveLeft = False
        self.moveRight = False
        self.controlComponent = ControlComponent()
        self.moveComponent = MoveComponent(self, screen)
        self.collisionComponent = CollisionComponent(self)
        self.tailComponent = TailComponent()
        self.components.append(self.controlComponent)
        self.components.append(self.moveComponent)
        self.components.append(self.collisionComponent)
        self.components.append(self.tailComponent)
        self.tailComponent.addNode(self)

    def update(self):
        self.controlComponent.update(self)
        self.moveComponent.update(self)
        self.tailComponent.update(self)
        self.screen.addToScreen(self.x, self.y, self.content)
Ejemplo n.º 2
0
class PlayerObject(Object):
    def __init__(self, parent, content, screen):
        Object.__init__(self, parent, content, screen)

        self.x = 2
        self.y = 2
        self.speed = 5
        self.moveUp = False
        self.moveDown = False
        self.moveLeft = False
        self.moveRight = False
        self.controlComponent = ControlComponent()
        self.moveComponent = MoveComponent(self, screen)
        self.collisionComponent = CollisionComponent(self)
        self.tailComponent = TailComponent()
        self.components.append(self.controlComponent)
        self.components.append(self.moveComponent)
        self.components.append(self.collisionComponent)
        self.components.append(self.tailComponent)
        self.tailComponent.addNode(self)

    def update(self):
        self.controlComponent.update(self)
        self.moveComponent.update(self)
        self.tailComponent.update(self)
        self.screen.addToScreen(self.x, self.y, self.content)
Ejemplo n.º 3
0
    def __init__(self, parent, content, screen):
        Object.__init__(self, parent, content, screen)

        self.x = 2
        self.y = 2
        self.speed = 5
        self.moveUp = False
        self.moveDown = False
        self.moveLeft = False
        self.moveRight = False
        self.controlComponent = ControlComponent()
        self.moveComponent = MoveComponent(self, screen)
        self.collisionComponent = CollisionComponent(self)
        self.tailComponent = TailComponent()
        self.components.append(self.controlComponent)
        self.components.append(self.moveComponent)
        self.components.append(self.collisionComponent)
        self.components.append(self.tailComponent)
        self.tailComponent.addNode(self)
Ejemplo n.º 4
0
    def __init__(self, parent, content, screen):
        Object.__init__(self, parent, content, screen)

        self.x = 2
        self.y = 2
        self.speed = 5
        self.moveUp = False
        self.moveDown = False
        self.moveLeft = False
        self.moveRight = False
        self.controlComponent = ControlComponent()
        self.moveComponent = MoveComponent(self, screen)
        self.collisionComponent = CollisionComponent(self)
        self.tailComponent = TailComponent()
        self.components.append(self.controlComponent)
        self.components.append(self.moveComponent)
        self.components.append(self.collisionComponent)
        self.components.append(self.tailComponent)
        self.tailComponent.addNode(self)