def activate(self): GameState.activate(self) w, h = sd.get_size() self.cr_open = scale(res.loadImage("open.png", 0, 1), (20,30)) self.cr_grasp = scale(res.loadImage("grasp.png", 0, 1), (20, 25)) self.cr_arrow = res.loadImage("next_arrow.png", 0, 1) self.cr = KeyCursor(self.cr_open) self.cr_state = HAND_OPEN self.cr_bounds = Rect(0,0,w,h).inflate(-w*.2, -h*.2) self.cr_bounds.height -= 30 self.cr_bounds.width -= 20 self.cr_pos = list(self.cr_bounds.center) self.cr_speed = 0 self.cr.enable() self.map_pos = self.cr_pos[:] path = res.mapPath("overworld3.tmx") self.tilemap = BufferedTilemapRenderer(path, (w,h), force_colorkey=(128,0,63)) self.camera = OverworldCamera([], self.tilemap, ((0,0), (w,h))) self.camera.center(self.cr_pos) self.tilemap.redraw() self.cleared = 0
def activate(self): GameState.activate(self) w, h = sd.get_size() self.cr_open = scale(res.loadImage("open.png", 0, 1), (20, 30)) self.cr_grasp = scale(res.loadImage("grasp.png", 0, 1), (20, 25)) self.cr_arrow = res.loadImage("next_arrow.png", 0, 1) self.cr = KeyCursor(self.cr_open) self.cr_state = HAND_OPEN self.cr_bounds = Rect(0, 0, w, h).inflate(-w * .2, -h * .2) self.cr_bounds.height -= 30 self.cr_bounds.width -= 20 self.cr_pos = list(self.cr_bounds.center) self.cr_speed = 0 self.cr.enable() self.map_pos = self.cr_pos[:] path = res.mapPath("overworld3.tmx") self.tilemap = BufferedTilemapRenderer(path, (w, h), force_colorkey=(128, 0, 63)) self.camera = OverworldCamera([], self.tilemap, ((0, 0), (w, h))) self.camera.center(self.cr_pos) self.tilemap.redraw() self.cleared = 0
def update(self, time): if self.queue_dialog: if self.cleared: sd.start(self.queue_dialog) self.queue_dialog = None self.cleared = False else: try: text = self.dialogs.pop() except IndexError: sd.done() return if text[:6] == "#image": fill = False tag, path = text.split(":") if path[0] == "+": fill = True path = path[1:] if tag[-8:] == "colorkey": image = res.loadImage(path, colorkey=1) elif tag[-5:] == "alpha": image = res.loadImage(path, alpha=1) else: image = res.loadImage(path) rect = image.get_rect() if fill: size = [ int(i) for i in sd.get_size() ] x = size[0] - rect.w y = size[1] - rect.h r = float(rect.w) / rect.h if x > y: rect = pygame.Rect((0,0,size[0],size[1]*r)) else: rect = pygame.Rect((0,0,size[0]*r,size[1])) rect.center = size[0] / 2, size[1] / 2 image = pygame.transform.smoothscale(image, rect.size) else: rect.topleft = ((sd.get_size()[0]/2)-(rect.width/2), 10) self.queue_image = (image, rect) self.cleared = False elif text[:6] == "#music": tag, path = text.split(":") self.queue_music = path else: self.queue_dialog = TextDialog(text)
def activate(self): self.activated = True res.fadeoutMusic() self.maps = [] self.change_delay = 8000 # seconds until map moves to next point self.map_fadeout = 60.0 # must be a float self.last_update = 0 self.surfaceQueue = queue() self.subpixelQueue = queue() self.hotspots = cycle(([300,500], [750, 800], [350, 260], [700, 340], [120, 1000], [800, 830], [480, 900])) self.overworld = res.loadImage("overworld.png") self.menu = cMenu(Rect((42,20), sd.get_size()), 20, 5, 'vertical', 100, [('New Game', self.new_game), ('Battle Test', self.continue_game), ('Introduction', self.show_intro), ('Quit Game', self.quit_game)], font="northwoodhigh.ttf", font_size=24) self.menu.ready() self.change_map()
def activate(self): xsize = 300 ysize = 70 bkg = Surface((xsize, ysize)) bkg.lock() bkg.fill((128,128,128)) for i in range(1, 4): draw.rect(bkg,(i*32,i*32,i*32),(4-i,4-i,xsize+(i-4)*2,ysize+(i-4)*2),3) corner = (64,64,64) bkg.set_at((0,0), corner) bkg.set_at((xsize,0), corner) bkg.set_at((xsize,ysize), corner) bkg.set_at((0,ysize), corner) bkg.unlock() bkg.set_alpha(64) self.bkg = bkg if self.title != None: banner = OutlineTextBanner(self.title, (200,200,200), 20) self.title_image = banner.render() self.title_image.set_alpha(96) self.arrow = res.loadImage("wait_arrow.png", colorkey=1)
def load(self): self.loaded = True return res.loadImage(self.filename, *self.args, **self.kwargs)
def load(self): self.tool_image = res.loadImage("pantool.png")
def load(self): self.image = res.loadImage(self.filename, *self.args, **self.kwargs) return self.image