def __init__(self, parent, username, xp, owned): selectGui.MainFrame.__init__(self, parent) self.a = games.load_sound("res/Sounds/WoT-Garage.ogg") self.a.play() self.conn = sqlite3.Connection("TankStats.db") self.cur = self.conn.cursor() #Variables passed from the login form self.username = username self.progress = xp self.parent = parent self.owned = owned #Set up config r = open("login.conf", "r") config = r.read().split("\n") self.ipAddr = getConfiguration(config, "ip_address") self.port = getConfiguration(config, "port") r.close() #Pull up all known tanks self.tanks = self.cur.execute("SELECT * FROM Tanks;").fetchall() self.allTanks = self.tanks #We only want the tanks that we own for i in range(len(owned) - 1, 0, -1): if owned[i] == 0: self.tanks.pop(i) self.conn.close() self.tankChoice.Clear() for i in range(len(self.tanks)): self.tankChoice.Append(self.tanks[i][0]) self.refresh(self.username)
def __init__(self): """ Инициализирует объект Game. """ # выбор начального игрового уровня self.level = 0 self.speed_asteroid = 2 self.bonus = [ 2, 4, 8, 10, 16, 20, 24, 32, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 ] self.life = games.Text(value=3, size=30, color=color.red, top=5, right=20, is_collideable=False) # загрузка звука, сопровождающего переход на следующий уровень self.sound = games.load_sound(os.path.join(STATIC, 'level.wav')) # создание объекта, в котором будет храниться текущий счёт self.score = games.Text(value=0, size=30, color=color.white, top=5, right=games.screen.width - 10, is_collideable=False) games.screen.add(self.score) games.screen.add(self.life) # создание корабля, которым будет управлять игрок self.ship = Ship(game=self, x=games.screen.width / 2, y=games.screen.height / 2) games.screen.add(self.ship)
def __init__(self, x, y, angle, turret, speed, hull_traverse, hp, reload, armour, name, id, damage, penetration, username, team): image = games.load_image("res/" + str(name) + "_body.png") super(LocalPlayer, self).__init__(image=image, x=x, y=y, angle=angle) self.name = name self.team = team self.turret = turret self.penetration = penetration self.bullets = [] self.newBullets = None self.username = username self.reload = reload self.damage = damage self.id = id self.va = [] self.fire = games.load_sound("res/Sounds/ms-1-45mm.ogg") self.idle = games.load_sound("res/Sounds/idle.ogg") self.moving = games.load_sound("res/Sounds/moving.ogg") self.canMove = False self.turret.canMove = False self.speed = speed self.hull_traverse = hull_traverse self.hp = int(hp) self.maxHp = self.hp self.reload_counter = self.reload self.armour = armour self.userTag = games.Text(value=self.username, x=x, y=y - 90, color=colour.black, size=20) self.nametag = games.Text(value=str(self.name) + " " + str(self.hp), x=x, y=y - 70, color=colour.black, size=20) self.reloadText = games.Text(value="Reload in: " + str(self.reload_counter), left=10, top=10, color=colour.red, size=30) self.orig_height = self.height - 30 self.orig_width = self.width games.screen.add(self.userTag) games.screen.add(self.reloadText) games.screen.add(self.nametag)
class Ship(games.Sprite): """ Корабль игрока. """ image = games.load_image(os.path.join(STATIC, 'mario.jpg')) # thrust.wav - звук ускоряющегося рывка sound = games.load_sound(os.path.join(STATIC, 'thrust.wav')) ROTATION_STEP = 3 # VELOCITY_STEP - константа для описания изменения скорости корабля VELOCITY_STEP = .03 # MISSILE_DELAY - количество обновлений экрана, в течение которых игрок не может выпустить ракету после очередного # запуска MISSILE_DELAY = 25 def __init__(self, x, y): """ Инициализирует спрайт с изображением космического корабля. """ super(Ship, self).__init__(image=Ship.image, x=x, y=y) # с помощью missile_wait будет отсчитываться задержка, упреждающая запуск очередной ракеты self.missile_wait = 0 def update(self): """ Вращает корабль при нажатии клавиш со стрелками. """ # вращает корабль при нажатии <- и -> if games.keyboard.is_pressed(games.K_LEFT): self.angle -= Ship.ROTATION_STEP if games.keyboard.is_pressed(games.K_RIGHT): self.angle += Ship.ROTATION_STEP # корабль совершает рывок при нажатии стрелки вверх if games.keyboard.is_pressed(games.K_UP): Ship.sound.play() # изменение горизонтальной и вертикальной скорости корабля с учётом угла поворота angle = self.angle * math.pi / 180 # преобразование в радианы self.dx += Ship.VELOCITY_STEP * math.sin(angle) self.dy += Ship.VELOCITY_STEP * -math.cos(angle) # корабль будет 'огибать' экран if self.top > games.screen.height: self.bottom = 0 if self.bottom < 0: self.top = games.screen.height if self.left > games.screen.width: self.right = 0 if self.right < 0: self.left = games.screen.width # если запуск следующей ракеты пока ещё не разрешён, вычесть 1 из длины оставшегося интервала ожидания if self.missile_wait > 0: self.missile_wait -= 1 # если нажат Space и интервал ожидания истёк, выпустить ракету if games.keyboard.is_pressed(games.K_SPACE) and self.missile_wait == 0: new_missile = Missile(self.x, self.y, self.angle) games.screen.add(new_missile) self.missile_wait = Ship.MISSILE_DELAY
class Ship(Collider): """ Корабль игрока. """ image = games.load_image(os.path.join(STATIC, 'ship.bmp')) # thrust.wav - звук ускоряющегося рывка sound = games.load_sound(os.path.join(STATIC, 'thrust.wav')) ROTATION_STEP = 3 # VELOCITY_STEP - константа для описания изменения скорости корабля VELOCITY_STEP = .03 # VELOCITY_MAX - константа ограничивающая максимальную скорость корабля VELOCITY_MAX = 3 # MISSILE_DELAY - количество обновлений экрана, в течение которых игрок не может выпустить ракету после очередного # запуска MISSILE_DELAY = 25 def __init__(self, game, x, y): """ Инициализирует спрайт с изображением космического корабля. """ super(Ship, self).__init__(image=Ship.image, x=x, y=y) self.game = game self.missile_wait = 0 def update(self): """ Вращает, ускоряет и выпускает ракеты при нажатии клавиш. """ super(Ship, self).update() # вращает корабль при нажатии <- и -> if games.keyboard.is_pressed(games.K_LEFT): self.angle -= Ship.ROTATION_STEP if games.keyboard.is_pressed(games.K_RIGHT): self.angle += Ship.ROTATION_STEP # корабль совершает рывок при нажатии стрелки вверх if games.keyboard.is_pressed(games.K_UP): Ship.sound.play() # изменение горизонтальной и вертикальной скорости корабля с учётом угла поворота angle = self.angle * math.pi / 180 # преобразование в радианы self.dx += Ship.VELOCITY_STEP * math.sin(angle) self.dy += Ship.VELOCITY_STEP * -math.cos(angle) # ограничение горизонтальной и вертикальной скорости self.dx = min(max(self.dx, -Ship.VELOCITY_MAX), Ship.VELOCITY_MAX) self.dy = min(max(self.dy, -Ship.VELOCITY_MAX), Ship.VELOCITY_MAX) # если запуск следующей ракеты пока ещё не разрешён, вычесть 1 из длины оставшегося интервала ожидания if self.missile_wait > 0: self.missile_wait -= 1 # если нажат Space и интервал ожидания истёк, выпустить ракету if games.keyboard.is_pressed(games.K_SPACE) and self.missile_wait == 0: new_missile = Missile(self.x, self.y, self.angle) games.screen.add(new_missile) self.missile_wait = Ship.MISSILE_DELAY def die(self): """ Разрушает корабль и завершает игру. """ self.game.end() super(Ship, self).die()
class Explosion(games.Animation): """ Explosion animation. """ sound = games.load_sound("explosion.wav") images = ["explosion1.bmp", "explosion2.bmp", "explosion3.bmp", "explosion4.bmp", \ "explosion5.bmp", "explosion6.bmp", "explosion7.bmp", "explosion8.bmp", "explosion9.bmp"] def __init__(self, x, y): super(Explosion, self).__init__(images = Explosion.images, x = x, y = y, \ repeat_interval = 4, n_repeats = 1, is_collideable = False) Explosion.sound.play()
class Missile(Collider): """ A missile launched by the player's ship. """ image = games.load_image("missile.bmp") sound = games.load_sound("missile.wav") BUFFER = 40 VELOCITY_FACTOR = 7 LIFETIME = 40 MISSILE_DELAY = 25 def __init__(self, ship_x, ship_y, ship_angle): """ Initialize the missile sprite. """ Missile.sound.play() # convert to radians angle = ship_angle * math.pi / 180 # calculate missile's starting position buffer_x = Missile.BUFFER * math.sin(angle) buffer_y = Missile.BUFFER * -math.cos(angle) x = ship_x + buffer_x y = ship_y + buffer_y # calculate missile's velocity components dx = Missile.VELOCITY_FACTOR * math.sin(angle) dy = Missile.VELOCITY_FACTOR * -math.cos(angle) # create the missile super(Missile, self).__init__(image = Missile.image, x = x, y = y, dx = dx, dy = dy) self.lifetime = Missile.LIFETIME def update(self): """ Move the missile. """ # if lifetime is up, destroy the missile self.lifetime -= 1 if self.lifetime == 0: self.destroy() # wrap the missile screen around if self.top > games.screen.height: self.bottom = 0 if self.bottom < 0: self.top = games.screen.height if self.left > games.screen.width: self.right = 0 if self.right < 0: self.left = games.screen.width def die(self): """ Destroy the missile. """ self.destroy() # check if ship overlaps any other object if self.overlapping_sprites: if self.overlapping_sprites: for sprite in self.overlapping_sprites: sprite.die() super(Asteroid, self).die() super(Missile, self).update()
def __init__(self): """ Cursor Initializer """ super(Cursor, self).__init__(image=games.load_image("Sprites/cursor.png"), x=games.mouse.x, y=games.mouse.y) self.mouseClicked = False self.mouseCounter = 0 # Load gunshot sound self.gunShotSound = games.load_sound("Sounds/shot.wav")
class Missile(games.Sprite): """ Ракета, которую может выпустить космический корабль игрока. """ image = games.load_image(os.path.join(STATIC, 'mario_missile.jpeg')) sound = games.load_sound(os.path.join(STATIC, 'missile.wav')) BUFFER = 40 VELOCITY_FACTOR = 7 LIFETIME = 40 def __init__(self, ship_x, ship_y, ship_angle): """ Инициализация спрайта с изображением ракеты. """ Missile.sound.play() # преобразование в радианы angle = ship_angle * math.pi / 180 # вычисление начальной позиции ракеты buffer_x = Missile.BUFFER * math.sin(angle) buffer_y = Missile.BUFFER * -math.cos(angle) x = ship_x + buffer_x y = ship_y + buffer_y # вычисление горизонатльной и вертикальной скорости ракеты dx = Missile.VELOCITY_FACTOR * math.sin(angle) dy = Missile.VELOCITY_FACTOR * -math.cos(angle) # создание ракеты super(Missile, self).__init__(image=Missile.image, x=x, y=y, dx=dx, dy=dy) # атрибут lifetime ограничивает время странствия ракеты по космосу self.lifetime = Missile.LIFETIME def update(self): """ Перемещаем ракету. """ # если lifetime ракеты истёк, то она уничтожается self.lifetime -= 1 if self.lifetime == 0: self.destroy() # ракета будет огибать экран if self.top > games.screen.height: self.bottom = 0 if self.bottom < 0: self.top = games.screen.height if self.left > games.screen.width: self.right = 0 if self.right < 0: self.left = games.screen.width
class Ship(Collider): """ The player's ship. """ image = games.load_image("ship.bmp") sound = games.load_sound("thrust.wav") ROTATION_STEP = 3 VELOCITY_STEP = .04 MISSILE_DELAY = 20 VELOCITY_MAX = 5 def __init__(self, game, x, y): """ Initiazlie ship sprite. """ super(Ship, self).__init__(image=Ship.image, x=x, y=y) self.missile_wait = 0 self.game = game def update(self): """ Rotate based on keys pressed. """ super(Ship, self).update() if games.keyboard.is_pressed(games.K_LEFT): self.angle -= Ship.ROTATION_STEP if games.keyboard.is_pressed(games.K_RIGHT): self.angle += Ship.ROTATION_STEP if games.keyboard.is_pressed(games.K_UP): Ship.sound.play() # change velocity components based on ship's angle angle = self.angle * math.pi / 180 # convert to radians self.dx += Ship.VELOCITY_STEP * math.sin(angle) self.dy += Ship.VELOCITY_STEP * -math.cos(angle) # cap velocity in each direction self.dx = min(max(self.dx, -Ship.VELOCITY_MAX), Ship.VELOCITY_MAX) self.dy = min(max(self.dy, -Ship.VELOCITY_MAX), Ship.VELOCITY_MAX) # fire missle if spacebar pressed and missle wait is over. if games.keyboard.is_pressed(games.K_SPACE) and self.missile_wait == 0: new_missile = Missile(self.x, self.y, self.angle) games.screen.add(new_missile) self.missile_wait = Ship.MISSILE_DELAY # if waiting until the ship can fire next, decrease wait if self.missile_wait > 0: self.missile_wait -= 1 def die(self): """ Destroy ship and end the game. """ self.game.end() super(Ship, self).die()
def __init__(self): """ Initialize Game object. """ self.level = 0 self.sound = games.load_sound("level.wav") # create a score self.score = games.Text(value = 0, size = 30, \ color = color.white, top = 5, right = games.screen.width - 10, \ is_collideable = False) games.screen.add(self.score) # create a player's ship self.ship = Ship(game=self, x=games.screen.width / 2, y=games.screen.height / 2) games.screen.add(self.ship)
def __init__(self): super(Clock, self).__init__(image=Game.image, x=0, y=0) # Timer Display self.timer = games.Text(value="1:00", size=50, x=300, y=435, color=color.white) games.screen.add(self.timer) self.clockCount = 0 self.seconds = 60 # Sound For Last 10 Seconds self.sound = games.load_sound("Sounds/beep.wav") self.started = False
class Ship(games.Sprite): """ Корабль игрока. """ image = games.load_image(os.path.join(STATIC, 'mario.jpg')) # thrust.wav - звук ускоряющегося рывка sound = games.load_sound(os.path.join(STATIC, 'thrust.wav')) ROTATION_STEP = 3 # VELOCITY_STEP - константа для описания изменения скорости корабля VELOCITY_STEP = .03 def update(self): """ Вращает корабль при нажатии клавиш со стрелками. """ # вращает корабль при нажатии <- и -> if games.keyboard.is_pressed(games.K_LEFT): self.angle -= Ship.ROTATION_STEP if games.keyboard.is_pressed(games.K_RIGHT): self.angle += Ship.ROTATION_STEP # корабль совершает рывок при нажатии стрелки вверх if games.keyboard.is_pressed(games.K_UP): Ship.sound.play() # изменение горизонтальной и вертикальной скорости корабля с учётом угла поворота angle = self.angle * math.pi / 180 # преобразование в радианы self.dx += Ship.VELOCITY_STEP * math.sin(angle) self.dy += Ship.VELOCITY_STEP * -math.cos(angle) # корабль будет 'огибать' экран if self.top > games.screen.height: self.bottom = 0 if self.bottom < 0: self.top = games.screen.height if self.left > games.screen.width: self.right = 0 if self.right < 0: self.left = games.screen.width # если нажат Space, выпустить ракету if games.keyboard.is_pressed(games.K_SPACE): new_missile = Missile(self.x, self.y, self.angle) games.screen.add(new_missile)
class Explosion(games.Animation): """ Анимированный взрыв. """ sound = games.load_sound(os.path.join(STATIC, 'explosion.wav')) images = [os.path.join(STATIC, 'explosion1.bmp'), os.path.join(STATIC, 'explosion2.bmp'), os.path.join(STATIC, 'explosion3.bmp'), os.path.join(STATIC, 'explosion4.bmp'), os.path.join(STATIC, 'explosion5.bmp'), os.path.join(STATIC, 'explosion6.bmp'), os.path.join(STATIC, 'explosion7.bmp'), os.path.join(STATIC, 'explosion8.bmp'), os.path.join(STATIC, 'explosion9.bmp')] def __init__(self, x, y): super(Explosion, self).__init__(images=Explosion.images, x = x, y = y, repeat_interval = 4, n_repeats = 1, is_collideable = False) Explosion.sound.play()
class Missile(Collider): """ A missle launched by th player's ship. """ image = games.load_image("missile.bmp") sound = games.load_sound("missile.wav") BUFFER = 40 VELOCITY_FACTOR = 8 LIFETIME = 50 def __init__(self, ship_x, ship_y, ship_angle): """ Initialize missile sprite. """ Missile.sound.play() # convert to radians angle = ship_angle * math.pi / 180 # calculate missile's starting position buffer_x = Missile.BUFFER * math.sin(angle) buffer_y = Missile.BUFFER * -math.cos(angle) x = ship_x + buffer_x y = ship_y + buffer_y # calculate missile's velocity components dx = Missile.VELOCITY_FACTOR * math.sin(angle) dy = Missile.VELOCITY_FACTOR * -math.cos(angle) # create the missile super(Missile, self).__init__(image=Missile.image, x=x, y=y, dx=dx, dy=dy) self.lifetime = Missile.LIFETIME def update(self): """ Move the missile. """ super(Missile, self).update() # if the lifetime is up, destroy the missile self.lifetime -= 1 if self.lifetime == 0: self.destroy()
def __init__(self, parent): loginGui.MainFrame.__init__(self, parent) self.parent = parent self.readConfig() self.a = games.load_sound("res/Sounds/WoT-Main-Theme.ogg") self.a.play()
# Звук и музыка # Демонстрирует воспроизведение звуков и музыкальных файлов import games import os STATIC = 'static/new' # Вызываем метод, инициализирующий окно games.init(screen_width=640, screen_height=480, fps=50) # загрузка звукового файла missile_sound = games.load_sound(os.path.join(STATIC, 'missile.wav')) # загрузка музыкального файла games.music.load(os.path.join(STATIC, 'mario_theme.mp3')) choice = None while choice != '0': print( """ Звук и музыка 0 - Выйти 1 - Воспроизвести звук ракетного залпа 2 - Циклизовать звук ракетного залпа 3 - Остановить звук ракетного залпа 4 - Воспроизвести музыкальную тему игры 5 - Циклизовать музыкальную тему игры
def setupGame(self,stats, host, port, username): """A method to load in all resources and set the game in motion""" #Create a connection self.connection = netComms.networkComms(host, int(port)) self.stats = stats self.username = username #Open resources self.fire = games.load_sound("res/Sounds/ms-1-45mm.ogg") self.idle = games.load_sound("res/Sounds/marder-idle.ogg") self.moskau = games.load_sound("res/Sounds/Moskau.ogg") self.moving = games.load_sound("res/Sounds/marder-moving.ogg") self.loadingSongs = [games.load_sound("res/Sounds/WoT-Opening-1.ogg"), games.load_sound("res/Sounds/WoT-Opening-2.ogg"), games.load_sound("res/Sounds/WoT-Opening-3.ogg")] self.battleSongs = [games.load_sound("res/Sounds/WoT-Battle-1.ogg"), games.load_sound("res/Sounds/WoT-Battle-2.ogg"), games.load_sound("res/Sounds/WoT-Battle-3.ogg"), games.load_sound("res/Sounds/WoT-Battle-4.ogg"), games.load_sound("res/Sounds/WoT-Battle-5.ogg")] self.despawnToServer = [] self.damageDone = [] name = self.stats[0] hp = self.stats[1] damage = self.stats[2] penetration = self.stats[3] reload = self.stats[4] armour = self.stats[5] hull_traverse = self.stats[6] turret_trav = self.stats[7] speed = self.stats[8] self.bg = games.load_image("background.png") self.update_ticks = 100 self.bulletType = Bullet(0, 0, 0, 0, 0, 0, 0) #Create local instances of player and turret #First we have to handshake self.connection.send(["handshake", name, hp, self.username]) #This will return us the currently connected players and our ID #print "RECV: "+str(self.connection.recieved) self.id = self.connection.recieved[0] if int(self.id) % 2 == 0: self.team = 0 else: self.team = 1 self.serverPlayers = self.connection.recieved[1] #Start countdown to the game self.countdown = self.connection.recieved[2] #Add a timer self.timerTop = games.Text(value="Game will start in:", x=400, y=300, size=50, color=colour.white) self.timerMain = games.Text(value=str(self.countdown), x=400, y=400, size=50, color=colour.white) if self.countdown == 0: self.close() #Set the map self.map = self.connection.recieved[3] self.drawMap(self.map) #Create these players, excluding us, as our movement is handled locally #Add us #We will get the data in the form [x,y,angle,turret angle] self.clientTurret = LocalTurret(self.serverPlayers[self.id][0], self.serverPlayers[self.id][1], self.serverPlayers[self.id][3], turret_trav, name) self.client = LocalPlayer(self.serverPlayers[self.id][0], self.serverPlayers[self.id][1], self.serverPlayers[self.id][2], self.clientTurret, speed, hull_traverse, hp, reload, armour, name, self.id, damage, penetration, self.username, self.team) #Start the countdown self.countdownThread = Thread(target=self.countingDown) self.countdownThread.start() #Add us to the screen games.screen.add(self.client) games.screen.add(self.clientTurret) games.screen.add(self.timerTop) games.screen.add(self.timerMain) #We have handled us, remove us from the list self.serverPlayers.pop(self.id) #Create some variables to hold the players self.serverInstances = [] self.serverInstancesTurret = [] self.bullets = [] self.toDespawn = [] self.toRebound = [] #Add everyone for p in self.serverPlayers: #Add a new turret instance self.serverInstancesTurret.append(Turret(p[0], p[1], p[3], p[4])) #Add a new player instance self.serverInstances.append( Player(p[0], p[1], p[2], p[4], p[5], p[6], self.serverInstancesTurret[-1], p[7], self.client.team)) #add them games.screen.add(self.serverInstances[-1]) games.screen.add(self.serverInstancesTurret[-1])
def setupGame(self, stats, host, port, username): """A method to load in all resources and set the game in motion""" #Create a connection self.connection = netComms.networkComms(host, int(port)) self.stats = stats self.username = username #Open resources self.fire = games.load_sound("res/Sounds/ms-1-45mm.ogg") self.idle = games.load_sound("res/Sounds/marder-idle.ogg") self.moskau = games.load_sound("res/Sounds/Moskau.ogg") self.moving = games.load_sound("res/Sounds/marder-moving.ogg") self.loadingSongs = [ games.load_sound("res/Sounds/WoT-Opening-1.ogg"), games.load_sound("res/Sounds/WoT-Opening-2.ogg"), games.load_sound("res/Sounds/WoT-Opening-3.ogg") ] self.battleSongs = [ games.load_sound("res/Sounds/WoT-Battle-1.ogg"), games.load_sound("res/Sounds/WoT-Battle-2.ogg"), games.load_sound("res/Sounds/WoT-Battle-3.ogg"), games.load_sound("res/Sounds/WoT-Battle-4.ogg"), games.load_sound("res/Sounds/WoT-Battle-5.ogg") ] self.despawnToServer = [] self.damageDone = [] name = self.stats[0] hp = self.stats[1] damage = self.stats[2] penetration = self.stats[3] reload = self.stats[4] armour = self.stats[5] hull_traverse = self.stats[6] turret_trav = self.stats[7] speed = self.stats[8] self.bg = games.load_image("background.png") self.update_ticks = 100 self.bulletType = Bullet(0, 0, 0, 0, 0, 0, 0) #Create local instances of player and turret #First we have to handshake self.connection.send(["handshake", name, hp, self.username]) #This will return us the currently connected players and our ID #print "RECV: "+str(self.connection.recieved) self.id = self.connection.recieved[0] if int(self.id) % 2 == 0: self.team = 0 else: self.team = 1 self.serverPlayers = self.connection.recieved[1] #Start countdown to the game self.countdown = self.connection.recieved[2] #Add a timer self.timerTop = games.Text(value="Game will start in:", x=400, y=300, size=50, color=colour.white) self.timerMain = games.Text(value=str(self.countdown), x=400, y=400, size=50, color=colour.white) if self.countdown == 0: self.close() #Set the map self.map = self.connection.recieved[3] self.drawMap(self.map) #Create these players, excluding us, as our movement is handled locally #Add us #We will get the data in the form [x,y,angle,turret angle] self.clientTurret = LocalTurret(self.serverPlayers[self.id][0], self.serverPlayers[self.id][1], self.serverPlayers[self.id][3], turret_trav, name) self.client = LocalPlayer(self.serverPlayers[self.id][0], self.serverPlayers[self.id][1], self.serverPlayers[self.id][2], self.clientTurret, speed, hull_traverse, hp, reload, armour, name, self.id, damage, penetration, self.username, self.team) #Start the countdown self.countdownThread = Thread(target=self.countingDown) self.countdownThread.start() #Add us to the screen games.screen.add(self.client) games.screen.add(self.clientTurret) games.screen.add(self.timerTop) games.screen.add(self.timerMain) #We have handled us, remove us from the list self.serverPlayers.pop(self.id) #Create some variables to hold the players self.serverInstances = [] self.serverInstancesTurret = [] self.bullets = [] self.toDespawn = [] self.toRebound = [] #Add everyone for p in self.serverPlayers: #Add a new turret instance self.serverInstancesTurret.append(Turret(p[0], p[1], p[3], p[4])) #Add a new player instance self.serverInstances.append( Player(p[0], p[1], p[2], p[4], p[5], p[6], self.serverInstancesTurret[-1], p[7], self.client.team)) #add them games.screen.add(self.serverInstances[-1]) games.screen.add(self.serverInstancesTurret[-1])