def on_update (self): # -- quit if adonthell.input_has_been_pushed (adonthell.SDLK_RETURN) or \ adonthell.input_has_been_pushed (adonthell.SDLK_SPACE) or \ adonthell.input_has_been_pushed (adonthell.SDLK_ESCAPE): # -- display second part of text if self.state == 1: self.text.set_text (_("There, inmidst your mistress' luggage, lies one of Master Fingolson's gems.")) self.text.pack () self.text.move (80, (self.height () - self.text.height ())/2) self.state = 2 # -- end else: adonthell.gamedata_engine ().main_quit ()
def on_update (self): # -- quit if adonthell.input_has_been_pushed (adonthell.SDLK_TAB): self.write_history () adonthell.gamedata_engine ().main_quit () # -- clear screen elif adonthell.input_has_been_pushed (adonthell.SDLK_DELETE): self.entry.set_text ("") # -- previous command elif adonthell.input_has_been_pushed (adonthell.SDLK_UP): if self.hist_idx > 0: self.hist_idx = self.hist_idx - 1 self.entry.set_text (self.history[ self.hist_idx ][:-1]) # -- next command elif adonthell.input_has_been_pushed (adonthell.SDLK_DOWN): if self.hist_idx < len (self.history) - 1: self.hist_idx = self.hist_idx + 1 self.entry.set_text (self.history[ self.hist_idx ][:-1])
def on_update(self): # -- quit if adonthell.input_has_been_pushed(adonthell.SDLK_TAB): self.write_history() adonthell.gamedata_engine().main_quit() # -- clear screen elif adonthell.input_has_been_pushed(adonthell.SDLK_DELETE): self.entry.set_text("") # -- previous command elif adonthell.input_has_been_pushed(adonthell.SDLK_UP): if self.hist_idx > 0: self.hist_idx = self.hist_idx - 1 self.entry.set_text(self.history[self.hist_idx][:-1]) # -- next command elif adonthell.input_has_been_pushed(adonthell.SDLK_DOWN): if self.hist_idx < len(self.history) - 1: self.hist_idx = self.hist_idx + 1 self.entry.set_text(self.history[self.hist_idx][:-1])
def on_update(self): if self.draw_func != None: # -- Skip intro sequence if adonthell.input_has_been_pushed(adonthell.SDLK_ESCAPE): adonthell.audio_fade_out_background(500) self.bag_t.set_visible(0) self.bag_c.set_visible(0) self.bag_o.set_visible(1) self.bag_o.set_alpha(255) self.draw_func = None self.show_menu(1, 0) # return self.retval return 1
def on_update (self): if self.draw_func != None: # -- Skip intro sequence if adonthell.input_has_been_pushed (adonthell.SDLK_ESCAPE): adonthell.audio_fade_out_background (500) self.bag_t.set_visible (0) self.bag_c.set_visible (0) self.bag_o.set_visible (1) self.bag_o.set_alpha (255) self.draw_func = None self.show_menu (1, 0) # return self.retval return 1
def run (self): # -- allow smooth movement on the veranda if self.myself.get_val ("on_veranda") == 1 and self.wnd == None: self.enable_veranda_hack () elif self.myself.get_val ("on_veranda") != 1 and self.wnd != None: self.disable_veranda_hack () # -- react to the action key if adonthell.input_has_been_pushed (adonthell.SDLK_SPACE) or \ adonthell.input_has_been_pushed (adonthell.SDLK_RETURN): # -- see whether a character(/object) is next to the player p = self.myself.whosnext () # - Yes :) if p != None and p.currentmove () < adonthell.WALK_NORTH: # -- launch the other guy's (object's) action script p.launch_action (self.myself) # -- Cleanup p = None # -- otherwise launch an action event elif p == None: evt = adonthell.action_event () evt.submap = self.myself.submap () evt.x = self.myself.posx () evt.y = self.myself.posy () evt.dir = self.myself.currentmove () evt.c = self.myself adonthell.event_handler_raise_event (evt) # -- move the player around elif adonthell.input_is_pushed (adonthell.SDLK_UP): self.myself.go_north () elif adonthell.input_is_pushed (adonthell.SDLK_DOWN): self.myself.go_south () elif adonthell.input_is_pushed (adonthell.SDLK_RIGHT): self.myself.go_east () elif adonthell.input_is_pushed (adonthell.SDLK_LEFT): self.myself.go_west ()