def __init__(self, screen, screen_width, screen_height): self.objectMatrix = [[None for i in xrange(450)] for j in xrange(450)] # screen self.screen = screen self.screen_width = screen_width self.screen_height = screen_height # frame if screen_width == 800: self.frame_width = 800 self.frame_height = 600 else: self.frame_width = 1024 self.frame_height = 768 self.frame = pygame.Surface((self.frame_width, self.frame_height), FULLSCREEN | HWSURFACE | DOUBLEBUF) # screen self.background = pygame.image.load(file('../tiles/background.png')).convert() self.tile_map = load_pygame('tile_map.tmx') Walls.Walls.pushWalls(self.tile_map) self.preLoadTiles() # shadows self.surf_lighting = pygame.Surface((self.frame_width, self.frame_height)) self.shad = shadow.Shadow() self.surf_falloff = pygame.image.load("../characters/img/light_falloff100.png").convert() radius = 208 self.shad.set_radius(radius) self.surf_falloff = pygame.transform.scale(self.surf_falloff, (radius * 2, radius * 2)) self.surf_falloff.convert() self.mask = self.shad.get_mask() self.mask.blit(self.surf_falloff, (0, 0), special_flags=BLEND_MULT) # textbox self.txt = GameTextBox.GameTextBox(self.screen_width, self.screen_height) # lifebar self.life = Header()
players = {} shots = [] newShots = [] # make window start in top left hand corner os.environ['SDL_VIDEO_WINDOW_POS'] = "%d,%d" % (0, 30) # setup pygame window WIN = pygame.display.set_mode([W, H]) pygame.display.set_caption("Networking Test") #Holds all the lighting information surf_lighting = pygame.Surface([W, H]) #Our shadowing object shad = shadow.Shadow() occluders = [ occluder.Occluder([[350, 350], [160, 150], [400, 500]]), occluder.Occluder([[500, 200], [450, 200], [350, 300]]) ] shad.set_occluders(occluders) shad.set_radius(300.0) #Falloff multiplier surf_falloff = pygame.image.load("light_falloff100.png") #surf_falloff = pygame.transform.scale(surf_falloff,[1800,1800]) surf_falloff.convert() NAME_FONT = pygame.font.SysFont("comicsans", 20)