def __init__(self): self.current_tick = 0 #event system self.onShipDeath = Broadcaster() self.onShipKill = Broadcaster() self.onBulletDeath = Broadcaster() self.onBulletTimeout = Broadcaster() self.onShipUpdate = Broadcaster() self.onBulletUpdate = Broadcaster() self.onLogicUpdate = Broadcaster() self.onShipReflectWall = Broadcaster() self.onShipReflectShip = Broadcaster() #required data self.bullet_list = [] self.wall_list = [] self.ship_list = [] #scoreboard self.scoreboard = scoreboard() self.onShipDeath+=self.scoreboard.on_ship_death self.onShipKill+=self.scoreboard.on_ship_kill
def __init__(self, location, bounds, shoot_delay, acceleration, max_speed, turn_rate, respawn_func = default_respawn, direction = 0, velocity = (0.0, 0.0), shield_duration = 120, curr_acceleration = (0.0, 0.0)): self.location = location self.bounds = bounds self.shoot_delay = shoot_delay self.delay = 0 self.velocity = velocity self.direction = direction self.rect = pygame.Rect(location[0]-bounds[0], location[1]-bounds[1], bounds[0]*2, bounds[1]*2) self.acceleration = acceleration self.max_speed = max_speed self.turn_rate = turn_rate self.death_timer = 0 self.respawn_func = respawn_func self.respawn_event = Broadcaster() self.moved = False self.shield_duration = self.shield = shield_duration*2 self.shield_obj = None self.curr_acceleration = curr_acceleration self.id = Ship.CUR_ID Ship.CUR_ID+=1
def __init__(self): self.onShipDeath = Broadcaster() self.onBulletDeath = Broadcaster()