def __init__(self, camera, user):
     super().__init__()
     self.type = "pointer"
     self.set_user(user)
     self.camera = camera
     self.position = position_system.get_position(self, 0, 0, 0, 5)
     self.input_component = input_system.get_component(self, "mouse")
Ejemplo n.º 2
0
 def __init__(self, ship, x, y, rot, ai=False, input="weapon"):
     super().__init__()
     self.type = "weapon"
     self.parent = ship
     self.firing = False
     self.position = position_system.get_position(self, x, y, rot, 0.4, 0.2)
     if not ai:
         self.input_component = input_system.get_component(self, input)
Ejemplo n.º 3
0
 def __init__(self, id, x, y, size=200, damage=20):
     super().__init__()
     self.type = "explosion"
     self.id = id
     self.lifetime = 1000
     self.init_lifetime = self.lifetime
     self.size_0 = size / 20
     self.size_1 = size
     self.damage = damage
     self.position = position_system.get_position(self, x, y, 0, size)
     self.collider_component = collision_system.get_component(
         self, "circle")
 def __init__(self, type="debug", x=0, y=0, rot=0, size_x=1, size_y=1, position=None, parent=None, track=None):
     super().__init__()
     self.type = type
     self.lifetime = 1
     if position is None:
         self.position = position_system.get_position(self, x, y, rot, size_x, size_y)
     else:
         self.position = position
     if parent is not None:
         self.parent = parent
     if track is not None:
         self.track = track
Ejemplo n.º 5
0
 def __init__(self, id, x, y, rot, v, size=2, damage=10, color="#ffffcc"):
     super().__init__()
     self.type = "bullet"
     self.id = id
     self.damage = damage
     self.color = color
     self.lifetime = 5000
     self.position = position_system.get_position(self, x, y, rot, size)
     self.physics_component = physics_system.get_component(self, "bullet")
     self.physics_component.vx = v * math.cos(rot)
     self.physics_component.vy = v * math.sin(rot)
     self.collider_component = collision_system.get_component(
         self, "circle")
 def __init__(self, laser, id, x, y, rot, length, dps, color="#00aa00"):
     super().__init__()
     self.parent = laser
     self.type = "laser_beam"
     self.id = id
     self.dps = dps
     self.lifetime = 1
     self.length = length
     self.color = color
     self.position = position_system.get_position(self, length, 0, 0,
                                                  length, 15)
     self.collider_component = collision_system.get_component(
         self, "line", length)
Ejemplo n.º 7
0
 def __init__(self, ship, size, health, regen_rate=0, downtime=1000):
     super().__init__()
     self.parent = ship
     self.type = "shield"
     self.id = ship.id
     self.health = health
     self.max_health = health
     self.regen_rate = regen_rate
     self.downtime = downtime
     self.downtime_left = downtime
     self.position = position_system.get_position(self, 0, 0, 0, size)
     self.collider_component = collision_system.get_component(
         self, "circle")
Ejemplo n.º 8
0
    def __init__(self, x, y, rot, v, v_rot, size=12):
        super().__init__()
        self.type = "loot"
        self.id = 3
        self.lifetime = 5e4 + random() * 5e4
        self.health = 1

        self.position = position_system.get_position(self, x, y, rot, size)
        self.collider_component = collision_system.get_component(
            self, "circle")
        self.physics_component = physics_system.get_component(self, "bullet")
        self.physics_component.vx = v * math.cos(rot)
        self.physics_component.vy = v * math.sin(rot)
        self.physics_component.v_rot = v_rot
Ejemplo n.º 9
0
 def __init__(self, ship, max_v, delta_v, delta_rot, ai=False):
     super().__init__()
     self.parent = ship
     self.type = "engine"
     self.max_v = max_v
     self.delta_v = delta_v
     self.delta_rot = delta_rot
     self.lifetime = 1
     self.accelerate = False
     self.deccelerate = False
     self.strafe_right = False
     self.strafe_left = False
     self.target_angle = 0
     if not ai:
         self.input_component = input_system.get_component(self, "engine")
     self.position = position_system.get_position(self, -1, 0, 0, 15)
Ejemplo n.º 10
0
    def __init__(self, world, ship, id, x, y, rot, v, size=15):
        super().__init__()
        self.type = "missile"
        self.ship = ship
        self.id = id
        self.lifetime = 10000
        self.trigger_time = 0.9 * self.lifetime
        self.position = position_system.get_position(self, x, y, rot, size)
        self.physics_component = physics_system.get_component(self, "bullet")
        self.physics_component.vx = v * math.cos(rot)
        self.physics_component.vy = v * math.sin(rot)
        self.physics_component.v_rot = 0.3
        self.collider_component = collision_system.get_component(
            self, "circle")

        self.engine = Engine(self, 10, 1, 0.2, True)
        world.entities.append(self.engine)
Ejemplo n.º 11
0
 def __init__(self, id, x, y, rot, size, health, engine, ai=False, target=None):
     super().__init__()
     self.type = "ship"
     self.id = id if ai else self._id + 5 
     self.health = health
     self.max_health = health
     self.lifetime = 1
     self.weapons = []
     self.engine = engine
     self.shield = None
     self.position = position_system.get_position(self, x, y, rot, size)
     if not ai:
         self.physics_component = physics_system.get_component(self, "ship")
         self.input_component = input_system.get_component(self, "ship")
     else:
         self.physics_component = physics_system.get_component(self, "bullet")
         self.ai_component = ai_system.get_component(self, "ship", target)
     self.collider_component = collision_system.get_component(self, "circle")