def __init__(self, pos, scale=1, **kw): """Initialize the game object.""" Collider.__init__(self, kw.get('shape', Collider.ELLIPSE)) Controllable.__init__(self, ConstantController(-1, 0)) Movable.__init__(self, pos) GameObject.__init__(self, GameObject.Priority.BOSS) self.__sprite = Sprite('media/images/asteroid.png', scale=scale, rotate=0)
def __init__(self, creator, color, origin, target, size=8): """Initialize the object.""" Collider.__init__(self, Collider.LINE) Controllable.__init__(self, self.__controller(origin, target, size)) Movable.__init__(self, origin) Hideable.__init__(self) GameObject.__init__(self, GameObject.Priority.PROJECTILE) self.__creator = type(creator) self.__color = color self.__next = None
def __init__(self, canvas, image, **kw): """Initialize Enemy object.""" Controllable.__init__(self, kw.get('controller', ConstantController(-1, 0))) Collider.__init__(self, kw.get('bounding_shape', Collider.RECT)) Movable.__init__( self, kw.get('position', (canvas[0] + 10, randint(50, canvas[1] - 50)))) GameObject.__init__(self, kw.get('priority', GameObject.Priority.NPC)) self.__sprite = Sprite(image, **kw) x, y, *_ = self.__sprite.bounds self.move(x, y)
def __init__(self, creator, color, origin, direction, **kwargs): """Initialize the object.""" Collider.__init__(self, Collider.LINE) Controllable.__init__(self, direction) Movable.__init__(self, origin) Hideable.__init__(self) GameObject.__init__(self, GameObject.Priority.PROJECTILE) self.__size = kwargs.get("size", 8) self.__creator = type(creator) self.__color = color self.__next = None self.__ignore_colision = tuple(kwargs.get('ignore_colision', ()))
def __init__(self, canvas, image, **kw): """Initialize Enemy object.""" Controllable.__init__(self, kw.get('controller', ConstantController(-1, 0))) Collider.__init__(self, kw.get('shape', Collider.RECT)) Movable.__init__(self, kw.get('position', (canvas[0] + 10, randint(50, canvas[1] - 50)))) Killable.__init__(self, Explosion.SMALL, time_scale=0.5) GameObject.__init__(self, GameObject.Priority.NPC) self. __sprite = Sprite(image, animate=kw.get('animate', False), cast_shadow=kw.get('cast_shadow', True))
def __init__(self, position, speed=5, controller=ConstantController(0, 0)): """Initialize the object.""" Collider.__init__(self, Collider.RECT) Controllable.__init__(self, controller) Movable.__init__(self, position) Killable.__init__(self, Explosion.BIG) GameObject.__init__(self, GameObject.Priority.PLAYER) self.__original_position = position self.__sprite = Sprite('media/images/f18.png') self.__lives = 3 self.__points = 0 self.__speed = speed self.__move = (0, 0)