def __init__(self): self.depth = 1 self.weaponsprite = sfml.graphics.Sprite( function.load_texture(constants.SPRITE_FOLDER + "weapons/miniguns/0.png") ) self.firingsprite = sfml.graphics.Sprite( function.load_texture(constants.SPRITE_FOLDER + "weapons/miniguns/2.png") )
def __init__(self): self.depth = 1 self.weaponsprite = sfml.Sprite( function.load_texture(constants.SPRITE_FOLDER + "weapons/miniguns/0.png")) self.firingsprite = sfml.Sprite( function.load_texture(constants.SPRITE_FOLDER + "weapons/miniguns/2.png"))
def __init__(self, window, manager): super(MainMenuHandler, self).__init__(window, manager) self.menubg = sfml.Sprite(function.load_texture(constants.SPRITE_FOLDER + "gameelements/menubackgrounds/%s.png" % random.randint(0,2))) self.menubg.x = 200 self.color = tuple(self.manager.config.setdefault('menu_color', [0.7, 0.25, 0])) self.color = sfml.Color(self.color[0] * 255, self.color[1] * 255, self.color[2] * 255)
def __init__(self, window, manager): super(LobbyHandler, self).__init__(window, manager) self.menuitems = [ ('Back to Main Menu', LobbyHandler.go_back), ('', None) ] self.menubg = sfml.Sprite(function.load_texture(constants.SPRITE_FOLDER + "gameelements/menubackgrounds/0.png")) self.menubg.x = 200 self.menubg.x = 200 self.color = tuple(self.manager.config.setdefault('menu_color', [0.7, 0.25, 0])) self.color = sfml.Color(self.color[0] * 255, self.color[1] * 255, self.color[2] * 255) self.sendbuf = b'' self.lobbysocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.num_servers = -1 self.servers_read = 0 self.lobbysocket.connect((constants.LOBBY_HOST, constants.LOBBY_PORT)) lobbyuuid = uuid.UUID(constants.LOBBY_MESSAGE_TYPE_LIST).get_bytes() self.protocoluuid = uuid.UUID(constants.GG2_LOBBY_UUID).get_bytes() self.send_all(lobbyuuid+self.protocoluuid) self.compatuuid = uuid.UUID(constants.PYGG2_COMPATIBILITY_PROTOCOL).get_bytes()
def __init__(self): self.depth = -1 self.sprites = [ sfml.Sprite( function.load_texture( constants.SPRITE_FOLDER + "ingameelements/sentryred/{0}.png".format(i))) for i in range(10) ]
def __init__(self): self.depth = 1 self.currentindex = -1 self.flamesprite = [ sfml.Sprite( function.load_texture(constants.SPRITE_FOLDER + "projectiles/flames/{}.png".format(i))) for i in range(3) ]
def __init__(self): self.depth = -1 self.base = sfml.Sprite( function.load_texture(constants.SPRITE_FOLDER + "ingameelements/sentryred/11.png")) self.turrets = [ sfml.Sprite( function.load_texture( constants.SPRITE_FOLDER + "ingameelements/sentryturrets/{0}.png".format(i))) for i in range(3) ] self.turning = [ sfml.Sprite( function.load_texture( constants.SPRITE_FOLDER + "ingameelements/turretrotates/{0}.png".format(i))) for i in range(5) ]
def initialize(self, renderer, game, state, character_id, spritepath): character = state.entities[character_id] if character.team == constants.TEAM_RED: team = "0" else: team = "1" self.hudsprite = sfml.Sprite(function.load_texture(constants.SPRITE_FOLDER + "huds/ammo/"+spritepath+"/"+team+".png")) self.background_bar.location = self.bar.location self.background_bar.color = sfml.Color(0, 0, 0, 255) self.bar.color = sfml.Color(217, 217, 183, 255)
def set_map(self, mapname): # Get all the layers of the background self.bgs = [] layer_list = os.listdir("maps/"+mapname+"/background") layer_list.sort() for layer in layer_list: self.bgs.append(sfml.Sprite(function.load_texture("maps/"+mapname+"/background/"+layer))) # Scale all maps 6x for background in self.bgs: background.ratio = sfml.system.Vector2(6, 6)
def __init__(self): self.depth = 0 self.sprites = [ sfml.Sprite( function.load_texture((constants.SPRITE_FOLDER + "characters/heavyreds/%s.png" % i))) for i in range(4) ] self.spriteoffset = (14, 30) self.spriteoffset_flipped = (26, 30)
def initialize(self, renderer, game, state, character_id, spritepath): character = state.entities[character_id] if character.team == constants.TEAM_RED: team = "0" else: team = "1" self.hudsprite = sfml.Sprite( function.load_texture(constants.SPRITE_FOLDER + "huds/ammo/" + spritepath + "/" + team + ".png")) self.background_bar.location = self.bar.location self.background_bar.color = sfml.Color(0, 0, 0, 255) self.bar.color = sfml.Color(217, 217, 183, 255)
def set_map(self, mapname): # Get all the layers of the background self.bgs = [] layer_list = os.listdir("maps/" + mapname + "/background") layer_list.sort() for layer in layer_list: self.bgs.append( sfml.Sprite( function.load_texture("maps/" + mapname + "/background/" + layer))) # Scale all maps 6x for background in self.bgs: background.ratio = sfml.system.Vector2(6, 6)
def __init__(self, renderer, game, state, character_id): self.sprite_location = (10, renderer.view_height - 75) character = state.entities[character_id] my_class_type = type(character) my_class_number = str(function.convert_class(my_class_type)) self.hudsprite = sfml.Sprite(function.load_texture(constants.SPRITE_FOLDER + "huds/characterhud/"+ my_class_number + ".png")) self.health_box_background = None self.health_box = None self.health_text = HealthText() self.health_text.health_location = (56, renderer.view_height - 52) self.health_text.health_size = (36, 36)
def __init__(self, renderer, game, state, character_id): self.sprite_location = (10, renderer.view_height - 75) character = state.entities[character_id] my_class_type = type(character) my_class_number = str(function.convert_class(my_class_type)) self.hudsprite = sfml.Sprite( function.load_texture(constants.SPRITE_FOLDER + "huds/characterhud/" + my_class_number + ".png")) self.health_box_background = None self.health_box = None self.health_text = HealthText() self.health_text.health_location = (56, renderer.view_height - 52) self.health_text.health_size = (36, 36)
def set_map(self, mapname): self.bgs = [sfml.Sprite(function.load_texture(("maps/"+ mapname[i] + ".png"))) for i in range(8)] for background in self.bgs: background.ratio = sfml.system.Vector2(6, 6)
def __init__(self): self.depth = 1 self.needlesprite = sfml.Sprite( function.load_texture(constants.SPRITE_FOLDER + "projectiles/needles/0.png"))
def __init__(self): self.depth = 1 self.weaponsprite = sfml.Sprite(function.load_texture(constants.SPRITE_FOLDER + "weapons/rocketlaunchers/0.png")) self.firingsprite = sfml.Sprite(function.load_texture(constants.SPRITE_FOLDER + "weapons/rocketlaunchers/2.png"))
def __init__(self): self.depth = 0 self.sprites = [sfml.Sprite(function.load_texture((constants.SPRITE_FOLDER + "characters/spyreds/%s.png" % i))) for i in range(4)] self.spriteoffset = (22, 30) self.spriteoffset_flipped = (33, 30)
def __init__(self): self.depth = 0 self.sprites = [sfml.Sprite(function.load_texture(("characters/scoutreds/%i.png" % i))) for i in range(4)] self.spriteoffset = (24, 30) self.spriteoffset_flipped = (35, 30)
def __init__(self): self.depth = 0 self.sprites = [sfml.Sprite(function.load_texture(("characters/engineerreds/%s.png" % i))) for i in range(4)] self.spriteoffset = (26, 30) self.spriteoffset_flipped = (36, 30)
def set_map(self, mapname): self.sprite = sfml.Sprite(function.load_texture("maps/" + mapname + ".png")) self.sprite.scale(6, 6)
def __init__(self): self.depth = 1 self.minesprite = sfml.graphics.Sprite(function.load_texture(constants.SPRITE_FOLDER + "projectiles/mines/1.png"))
def __init__(self): self.depth = -1 self.base = sfml.Sprite(function.load_texture(constants.SPRITE_FOLDER + "ingameelements/sentryred/11.png")) self.turrets = [sfml.Sprite(function.load_texture(constants.SPRITE_FOLDER + "ingameelements/sentryturrets/{0}.png".format(i))) for i in range(3)] self.turning = [sfml.Sprite(function.load_texture(constants.SPRITE_FOLDER + "ingameelements/turretrotates/{0}.png".format(i))) for i in range(5)]
def __init__(self): self.depth = 0 self.sprites = [sfml.graphics.Sprite(function.load_texture((constants.SPRITE_FOLDER + "characters/quotereds/%s.png" % i))) for i in range(4)] self.spriteoffset = (16, -1) self.spriteoffset_flipped = (16, -1)
def __init__(self): self.depth = 1 self.currentindex = -1 self.flamesprite = [sfml.Sprite(function.load_texture(constants.SPRITE_FOLDER + "projectiles/flames/{}.png".format(i))) for i in range(3)]
def __init__(self): self.depth = 1 self.bladesprite = sfml.Sprite(function.load_texture("projectiles/bladeprojectiles/0.png"))
def __init__(self): self.depth = 1 self.weaponsprite = sfml.Sprite(function.load_texture("weapons/shotguns/0.png")) self.firingsprite = sfml.Sprite(function.load_texture("weapons/shotguns/2.png"))
def __init__(self): self.depth = 1 self.bladesprite = sfml.Sprite(function.load_texture(constants.SPRITE_FOLDER + "projectiles/bladeprojectiles/0.png"))
def __init__(self): self.depth = -1 self.sprites = [sfml.Sprite(function.load_texture(constants.SPRITE_FOLDER + "ingameelements/sentryred/{0}.png".format(i))) for i in range(10)]