コード例 #1
0
    def __init__(self, tag, color, width, length, position, velocity,
                 time_to_live):
        """
        
        Arguments:
            tag {string} -- tag for this laser

            color {RGB tuple} -- color of the laser

            width {int} -- width of the laser

            length {float} -- length of the laser

            position {Vector2} -- start position of the laser

            velocity {Vector2} -- velocity vector for the laser
            
            time_to_live {float} -- time to live of the laser
        """
        Engine.GameObject.__init__(self, tag)

        self.collider = Engine.Circle2d(Vector2(0, 0), width)
        self.start_position = position
        self.position = position
        self.velocity = velocity
        self.direction = velocity.normalize()
        self.color = color
        self.width = width
        self.length = length
        self.time_to_live = time_to_live
        self.tags.append(tag)
コード例 #2
0
    def __init__(self, name):
        """
        
        Arguments:
            name {string} -- Name of the ship object
        """
        Ship.__init__(self, name)

        self.gfx = Engine.WireMesh.get_model("PlayerShip")
        self.collider = Engine.Circle2d(Vector2(0, 0), self.gfx.get_radius())
        self.radius = self.max_radius = self.gfx.get_radius()
        self.shot_cooldown = 0.25
        self.current_shot_cooldown = 0

        self.tags.append("PlayerShip")

        self.engine_sound = Engine.SoundManager.play("Engine", 0, True)