def run (self, requester): if requester.get_name() == adonthell.gamedata_player ().get_name(): # -- get characters' current state player_state = requester.is_paused () npc_state = self.myself.is_paused () # -- deactivate the schedule of the characters involved self.myself.pause () requester.pause () # player isn't event-driven yet requester.set_schedule_active (0) # -- don't allow access to main menu and stuff adonthell.gamedata_engine ().set_control_active (0) # -- look into the player's face self.myself.look_invert (requester.currentmove ()) # -- init the dialogue engine dlg = adonthell.dialog_screen (self.myself, self.myself.get_dialogue (), 0) # -- make sure the engine isn't deleted when we leave the script dlg.thisown = 0 # -- attach the callback dlg.py_signal_connect (self.restore_schedule, adonthell.win_event_CLOSE, (player_state, npc_state, requester, self.myself)) # -- add the dialogue window to the win_manager adonthell.win_manager_get_active ().add (dlg) adonthell.win_manager_get_active ().set_focus (dlg) # -- start the dialogue dlg.run ()
def on_execute(self): text = self.entry.text_char() # -- if we have a command ... if text != None: # -- ... add it to command history ... if self.hist_idx == 0 or text != self.history[-1]: self.history.append(text + '\n') self.hist_idx = len(self.history) # -- quit? if text == "quit" or text == "exit": self.write_history() adonthell.gamedata_engine().main_quit() # -- ... and try to execute it try: result = eval(text, self.namespace) self.entry.set_text(str(result)) except: type, value = sys.exc_info()[:2] error = "Error:\n " + str(type) + ":\n \"" + str( value) + "\"" self.entry.set_text(error)
def play_intro (self): # -- Launches the intro import intro # -- start the mapengine adonthell.gamedata_engine ().mapview_start () adonthell.gametime_update () adonthell.gamedata_engine ().fade_in ()
def play_intro(self): # -- Launches the intro import intro # -- start the mapengine adonthell.gamedata_engine().mapview_start() adonthell.gametime_update() adonthell.gamedata_engine().fade_in()
def restore_schedule (self, retval, args): # -- activate the characters' schedules # player isn't event-driven yet args[2].set_schedule_active (1) if not args[0]: args[2].resume () if not args[1]: args[3].resume () if adonthell.gamedata_get_quest ("demo").get_val ("the_end") != 1: adonthell.gamedata_engine ().set_control_active (1)
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 put_object (self, args): object, update = args[:] # -- the table we're next to index = self.myself.get_val ("table_num") if index > 0: # -- see whether table is laid or not key = "table%i_set" % index val = self.myself.get_val (key) x, y = self.coords[index+4][:2] if val == 0: adonthell.gamedata_engine ().get_landmap ().put_mapobject (1, x, y, object) if update == 1: self.myself.set_val (key, 1) else: adonthell.gamedata_engine ().get_landmap ().remove_mapobject (1, x, y, object) if update == 1: self.myself.set_val (key, 0)
def open_gate (self): # Get the mapobjects gate_fore = adonthell.gamedata_engine ().get_landmap ().get_mapobject (90) gate_back = adonthell.gamedata_engine ().get_landmap ().get_mapobject (89) # Only open the gate if it's closed... if (gate_fore.get_animation (0).currentframe () == 0): # Plays the gate back animation gate_back.get_animation (0).next_frame () # Plays the gate fore animation gate_fore.get_animation (0).next_frame () # Update squares walkability sm = adonthell.gamedata_engine ().get_landmap ().get_submap (0) sm.get_square (6, 17).set_walkable_south (0) sm.get_square (7, 17).set_walkable_south (0) sm.get_square (6, 18).set_walkable_west (1) sm.get_square (6, 19).set_walkable_west (1)
def scroll_credits(self): self.anim = self.anim + 1 if self.anim % 3 != 0: return if self.step == 0: idx = 0 # -- scroll all visible labels while idx < len(self.labels): label = self.labels[idx] label.move(label.x(), label.y() - 1) # -- remove label once it is through if label.y() + label.height() < -5: self.labels.remove(label) # -- next else: idx = idx + 1 # -- stop 'The END' in the middle of the screen if self.credits[self.index][1] == -1: if label.y() + label.height() / 2 == 90: self.labels.remove(label) self.delay = 0 self.step = 1 # -- else, add new line if necessary elif label.y() - 180 < 0: self.make_credit_label(label.y() + label.height()) # -- wait a little elif self.step == 1: self.delay = self.delay + 1 if self.delay == 70: self.make_credit_label(90) self.step = 2 # -- finish elif self.step == 2: self.delay = self.delay + 1 if self.delay == 100: adonthell.gamedata_engine().main_quit()
def put_object(self, args): object, update = args[:] # -- the table we're next to index = self.myself.get_val("table_num") if index > 0: # -- see whether table is laid or not key = "table%i_set" % index val = self.myself.get_val(key) x, y = self.coords[index + 4][:2] if val == 0: adonthell.gamedata_engine().get_landmap().put_mapobject( 1, x, y, object) if update == 1: self.myself.set_val(key, 1) else: adonthell.gamedata_engine().get_landmap().remove_mapobject( 1, x, y, object) if update == 1: self.myself.set_val(key, 0)
def scroll_credits (self): self.anim = self.anim + 1 if self.anim % 3 != 0: return if self.step == 0: idx = 0 # -- scroll all visible labels while idx < len (self.labels): label = self.labels[idx] label.move (label.x (), label.y () - 1) # -- remove label once it is through if label.y () + label.height () < -5: self.labels.remove (label) # -- next else: idx = idx + 1 # -- stop 'The END' in the middle of the screen if self.credits[self.index][1] == -1: if label.y () + label.height ()/2 == 90: self.labels.remove (label) self.delay = 0 self.step = 1 # -- else, add new line if necessary elif label.y () - 180 < 0: self.make_credit_label (label.y () + label.height ()) # -- wait a little elif self.step == 1: self.delay = self.delay + 1 if self.delay == 70: self.make_credit_label (90) self.step = 2 # -- finish elif self.step == 2: self.delay = self.delay + 1 if self.delay == 100: adonthell.gamedata_engine ().main_quit ()
def make_bubble(self): (npc, text) = self.text[self.index] length = len(text) + 100 if npc != None: # -- get color color = self.colors[npc.get_color()] # -- get position view = adonthell.gamedata_engine().get_mapview() area = adonthell.gamedata_engine().get_landmap().get_submap(7) offx = 0 offy = 0 if area.area_length() * 20 < view.length(): offx = (view.length() - area.area_length() * 20) / 2 if ((area.area_height() * 20) < view.height()): offy = (view.height() - area.area_height() * 20) / 2 x = (npc.posx() - view.posx()) * 20 + offx + 10 - length / 2 y = (npc.posy() - view.posy()) * 20 + offy - 15 else: color = 'red' # -- make bubble bubble = adonthell.text_bubble(text, color, 'original', length) bubble.thisown = 0 # -- move it to the right place if npc != None: bubble.move(x, y - bubble.height()) else: bubble.move(160 - bubble.length() / 2, 20) # -- display bubble.set_visible(1) adonthell.win_manager_get_active().add(bubble) bubble.py_signal_connect(self.on_close_bubble, adonthell.win_event_CLOSE) return bubble
def zoom_to_chest (self): self.window = adonthell.win_container () self.window.move (0, 0) self.window.resize (320, 240) self.window.set_visible_border (0) self.window.add (self.wall) self.window.add (self.chest) self.window.set_activate (1) self.window.set_visible_all (1) self.window.py_signal_connect (self.on_draw, adonthell.win_event_UPDATE) self.draw_func = self.move_chest self.step = 0 self.done = 1 if self.bubble != None: adonthell.win_manager_get_active ().remove (self.bubble) self.bubble = None adonthell.gamedata_engine ().main (self.window, 'fmv')
def switch_submap (mychar, x, y, submap, dir): # -- deactivate schedule during teleport if mychar.is_schedule_activated (): mychar.set_schedule_active (0) schedule_active = 1 else: schedule_active = 0 # -- only fade for the player if mychar.get_id () == "Player": # -- fade the new submap in if we teleport the player adonthell.gamedata_engine ().fade_out () mychar.jump_to (x, y, submap, dir) adonthell.gamedata_engine ().fade_in () else: mychar.jump_to (x, y, submap, dir) # -- restore character's schedule if schedule_active == 1: mychar.set_schedule_active (1)
def zoom_to_chest(self): self.window = adonthell.win_container() self.window.move(0, 0) self.window.resize(320, 240) self.window.set_visible_border(0) self.window.add(self.wall) self.window.add(self.chest) self.window.set_activate(1) self.window.set_visible_all(1) self.window.py_signal_connect(self.on_draw, adonthell.win_event_UPDATE) self.draw_func = self.move_chest self.step = 0 self.done = 1 if self.bubble != None: adonthell.win_manager_get_active().remove(self.bubble) self.bubble = None adonthell.gamedata_engine().main(self.window, 'fmv')
def make_bubble (self): (npc, text) = self.text[self.index] length = len(text) + 100 if npc != None: # -- get color color = self.colors[npc.get_color ()] # -- get position view = adonthell.gamedata_engine ().get_mapview () area = adonthell.gamedata_engine ().get_landmap ().get_submap (7) offx = 0 offy = 0 if area.area_length () * 20 < view.length (): offx = (view.length () - area.area_length () * 20) / 2 if ((area.area_height() * 20) < view.height()): offy = (view.height () - area.area_height() * 20) / 2 x = (npc.posx () - view.posx ()) * 20 + offx + 10 - length / 2 y = (npc.posy () - view.posy ()) * 20 + offy - 15 else: color = 'red' # -- make bubble bubble = adonthell.text_bubble (text, color, 'original', length) bubble.thisown = 0 # -- move it to the right place if npc != None: bubble.move (x, y - bubble.height ()) else: bubble.move (160 - bubble.length () / 2, 20) # -- display bubble.set_visible (1) adonthell.win_manager_get_active ().add (bubble) bubble.py_signal_connect (self.on_close_bubble, adonthell.win_event_CLOSE) return bubble
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_draw (self, mychar): if mychar.submap () == 0 and mychar.posx () >= 17 and mychar.posx () <= 19 \ and mychar.posy () == 12: view = adonthell.gamedata_engine ().get_mapview () x = (mychar.posx () - view.posx () - mychar.base_x ()) * 20 \ + mychar.offx () - view.offx () y = (mychar.posy () - view.posy () - mychar.base_y ()) * 20 \ + mychar.offy () - view.offy () mychar.draw (x, y)
def on_execute (self): text = self.entry.text_char () # -- if we have a command ... if text != None: # -- ... add it to command history ... if self.hist_idx == 0 or text != self.history[-1]: self.history.append (text + '\n') self.hist_idx = len (self.history) # -- quit? if text == "quit" or text == "exit": self.write_history () adonthell.gamedata_engine ().main_quit () # -- ... and try to execute it try: result = eval (text, self.namespace) self.entry.set_text (str (result)) except: type, value = sys.exc_info()[:2] error = "Error:\n " + str (type) + ":\n \"" + str (value) + "\"" self.entry.set_text (error)
def run(self): # -- deactivate game controls if self.index == 0: adonthell.gamedata_engine().set_control_active(0) # -- Bjarn walks up to chest elif self.index == 20: bjarn = self.text[3][0] if self.done == 0: bjarn.set_goal(7, 3, adonthell.STAND_NORTH) self.done = 1 if (bjarn.follow_path() == 0): return else: adonthell.gamedata_player().set_schedule_active(0) self.index = self.index + 1 self.zoom_to_chest() return # -- Talan bursts in elif self.index == 25 and self.done == 0: bjarn = self.text[3][0] bjarn.go_south() bjarn.load('bjarn_crying.mchar') talan = adonthell.gamedata_get_character('Talan Wendth') talan.load("talan_beaten.mchar") events.switch_submap(talan, 7, 1, 6, adonthell.STAND_EAST) # -- everyone look at Talan adonthell.gamedata_get_character("Erek Stonebreaker").stand_west() adonthell.gamedata_get_character("Jelom Rasgar").stand_west() adonthell.gamedata_get_character("Imoen Silverhair").stand_west() adonthell.gamedata_player().stand_west() talan.go_east() talan.stand_south() self.done = 1 elif self.index == 36 and self.bubble == None: # -- shutdown the mapview, it's no longer needed adonthell.gamedata_player().set_schedule_active(0) adonthell.gamedata_engine().fade_out() adonthell.gamedata_engine().mapview_stop() self.fade_to_forest() return if self.bubble == None: self.index = self.index + 1 self.bubble = self.make_bubble() self.done = 0
def run (self): # -- deactivate game controls if self.index == 0: adonthell.gamedata_engine ().set_control_active (0) # -- Bjarn walks up to chest elif self.index == 20: bjarn = self.text[3][0] if self.done == 0: bjarn.set_goal (7, 3, adonthell.STAND_NORTH) self.done = 1 if (bjarn.follow_path () == 0): return else: adonthell.gamedata_player ().set_schedule_active (0) self.index = self.index + 1 self.zoom_to_chest () return # -- Talan bursts in elif self.index == 25 and self.done == 0: bjarn = self.text[3][0] bjarn.go_south () bjarn.load ('bjarn_crying.mchar') talan = adonthell.gamedata_get_character ('Talan Wendth') talan.load ("talan_beaten.mchar") events.switch_submap (talan, 7, 1, 6, adonthell.STAND_EAST) # -- everyone look at Talan adonthell.gamedata_get_character ("Erek Stonebreaker").stand_west () adonthell.gamedata_get_character ("Jelom Rasgar").stand_west () adonthell.gamedata_get_character ("Imoen Silverhair").stand_west () adonthell.gamedata_player ().stand_west () talan.go_east () talan.stand_south () self.done = 1 elif self.index == 36 and self.bubble == None: # -- shutdown the mapview, it's no longer needed adonthell.gamedata_player ().set_schedule_active (0) adonthell.gamedata_engine ().fade_out () adonthell.gamedata_engine ().mapview_stop () self.fade_to_forest () return if self.bubble == None: self.index = self.index + 1 self.bubble = self.make_bubble () self.done = 0
def run (self, submap, x, y, dir, name): if adonthell.gamedata_get_quest ("demo").get_val ("get_item") == 1: fgs = find_gem_screen () adonthell.gamedata_engine ().set_control_active (0) adonthell.gamedata_player ().set_schedule_active (0) adonthell.gamedata_engine ().main (fgs, "find_gem_screen") adonthell.gamedata_player ().set_schedule_active (1) adonthell.gamedata_engine ().set_control_active (1) adonthell.gamedata_get_quest ("demo").set_val ("get_item", 2) adonthell.gamedata_get_quest ("demo").set_val ("have_gem", 1) else: self.mapchar.speak (_("I know this chest. The Lady uses it on her journeys."))
del self.bag_o del self.bag_c del self.bag_t adonthell.audio_fade_out_background(500) adonthell.audio_unload_background(0) def play_intro(self): # -- Launches the intro import intro # -- start the mapengine adonthell.gamedata_engine().mapview_start() adonthell.gametime_update() adonthell.gamedata_engine().fade_in() # -- Main -- adonthell.audio_load_wave(0, "audio/select.wav") adonthell.audio_load_wave(1, "audio/switch.wav") adonthell.audio_load_wave(2, "audio/unselect.wav") if adonthell.gamedata_load_newest() == 0: title = title_screen() else: # -- Quick-load adonthell.gamedata_player().set_schedule_active(1) adonthell.gametime_start_action() adonthell.gamedata_engine().main()
del self.bag_o del self.bag_c del self.bag_t adonthell.audio_fade_out_background (500) adonthell.audio_unload_background (0) def play_intro (self): # -- Launches the intro import intro # -- start the mapengine adonthell.gamedata_engine ().mapview_start () adonthell.gametime_update () adonthell.gamedata_engine ().fade_in () # -- Main -- adonthell.audio_load_wave (0, "audio/select.wav") adonthell.audio_load_wave (1, "audio/switch.wav") adonthell.audio_load_wave (2, "audio/unselect.wav") if adonthell.gamedata_load_newest () == 0: title = title_screen () else: # -- Quick-load adonthell.gamedata_player ().set_schedule_active (1) adonthell.gametime_start_action () adonthell.gamedata_engine ().main ()
def show_menu (self, a, b): menu = main_menu.main_menu (a, b) # -- open the menu adonthell.gamedata_engine ().main (menu, "game_menu") # -- once the menu is closed, see what we got retval = menu.get_result () # -- start new game if retval == 1: # -- let the player chose a name for his character import character_screen cs = character_screen.character_screen () adonthell.gamedata_engine ().main (cs, "character_screen") adonthell.gamedata_engine ().fade_out () self.cleanup () # -- load the initial game adonthell.gamedata_load (0) adonthell.gamedata_player ().set_name (cs.name) # -- on to the intro self.play_intro () # -- Load game elif retval == 2: adonthell.gamedata_player ().set_schedule_active (1) self.window.set_visible (0) self.cleanup () adonthell.gamedata_engine ().mapview_start () adonthell.gamedata_engine ().set_control_active (1) adonthell.gamedata_engine ().fade_in () # -- quit the game else: adonthell.gamedata_engine ().main_quit () adonthell.win_container.__del__ (menu)
def run(self, submap, x, y, dir, name): adonthell.gamedata_engine().get_landmap().get_mapobject(0).get_animation(0).next_frame()
def on_enter (self): self.name = self.entry.text_char () adonthell.gamedata_engine ().main_quit ()
def __init__ (self): # -- load our music adonthell.audio_load_background (0, "audio/at-demo-1.ogg") # -- The themes and fonts we'll use adonthell.win_manager_add_theme ("original") adonthell.win_manager_add_theme ("silverleaf") adonthell.win_manager_add_font ("yellow") adonthell.win_manager_add_font ("red") adonthell.win_manager_add_font ("violet") adonthell.win_manager_add_font ("blue") adonthell.win_manager_add_font ("green") adonthell.win_manager_add_font ("white") adonthell.win_manager_add_font ("original") adonthell.win_manager_add_font ("silverleaf") # -- load our images self.bag_o = adonthell.win_image () self.bag_o.load_raw ("gfx/cutscene/jewelbag_open.img") self.bag_o.set_alpha (0) self.bag_o.move (0, 0) self.bag_o.pack () self.bag_o.set_visible (0) self.bag_c = adonthell.win_image () self.bag_c.load_raw ("gfx/cutscene/jewelbag_closed.img") self.bag_c.set_visible (1) self.bag_c.set_alpha (0) self.bag_c.move (0, 0) self.bag_c.pack () self.bag_t = adonthell.win_image () self.bag_t.load_raw ("gfx/cutscene/adonthell_03.img") self.bag_t.move (33, 86) self.bag_t.pack () self.bag_t.set_visible (0) # -- create the window self.window = adonthell.win_container () self.window.move (0, 0) self.window.resize (320, 240) self.window.set_visible_border (0) # -- the order here is essential self.window.add (self.bag_c) self.window.add (self.bag_t) self.window.add (self.bag_o) self.window.set_activate (1) self.window.set_visible (1) self.window.py_signal_connect (self.on_update, adonthell.win_event_UPDATE) self.window.py_signal_connect (self.on_draw, adonthell.win_event_DRAW) self.draw_func = self.initial_fade_in self.alpha = 0 adonthell.audio_play_background (0) # -- launch the engine adonthell.gametime_start_action () adonthell.gamedata_engine ().main (self.window, "title_sequence")
def __init__(self): # -- load our music adonthell.audio_load_background(0, "audio/at-demo-1.ogg") # -- The themes and fonts we'll use adonthell.win_manager_add_theme("original") adonthell.win_manager_add_theme("silverleaf") adonthell.win_manager_add_font("yellow") adonthell.win_manager_add_font("red") adonthell.win_manager_add_font("violet") adonthell.win_manager_add_font("blue") adonthell.win_manager_add_font("green") adonthell.win_manager_add_font("white") adonthell.win_manager_add_font("original") adonthell.win_manager_add_font("silverleaf") # -- load our images self.bag_o = adonthell.win_image() self.bag_o.load_raw("gfx/cutscene/jewelbag_open.img") self.bag_o.set_alpha(0) self.bag_o.move(0, 0) self.bag_o.pack() self.bag_o.set_visible(0) self.bag_c = adonthell.win_image() self.bag_c.load_raw("gfx/cutscene/jewelbag_closed.img") self.bag_c.set_visible(1) self.bag_c.set_alpha(0) self.bag_c.move(0, 0) self.bag_c.pack() self.bag_t = adonthell.win_image() self.bag_t.load_raw("gfx/cutscene/adonthell_03.img") self.bag_t.move(33, 86) self.bag_t.pack() self.bag_t.set_visible(0) # -- create the window self.window = adonthell.win_container() self.window.move(0, 0) self.window.resize(320, 240) self.window.set_visible_border(0) # -- the order here is essential self.window.add(self.bag_c) self.window.add(self.bag_t) self.window.add(self.bag_o) self.window.set_activate(1) self.window.set_visible(1) self.window.py_signal_connect(self.on_update, adonthell.win_event_UPDATE) self.window.py_signal_connect(self.on_draw, adonthell.win_event_DRAW) self.draw_func = self.initial_fade_in self.alpha = 0 adonthell.audio_play_background(0) # -- launch the engine adonthell.gametime_start_action() adonthell.gamedata_engine().main(self.window, "title_sequence")
def fade_to_forest(self): # -- drawing area self.da = adonthell.drawing_area() self.da.resize(adonthell.screen_length(), adonthell.screen_height()) self.da.move(0, 0) # -- load images self.wood1 = adonthell.image() self.wood1.load_raw("gfx/cutscene/forest3.img") self.wood2 = adonthell.image() self.wood2.load_raw("gfx/cutscene/forest2.img") self.wood2.set_mask(1) self.wood3 = adonthell.image() self.wood3.load_raw("gfx/cutscene/forest1.img") self.wood3.set_mask(1) self.alek_run = adonthell.animation() self.alek_run.load("gfx/cutscene/running_alek.anim") self.alek_run.play() self.black = adonthell.win_image() self.black.resize(320, 240) self.black.fillrect(0, 0, 320, 240, 0) self.black.thisown = 0 self.black.pack() # -- label self.label = adonthell.win_label() self.label.set_font(adonthell.win_manager_get_font("white")) self.label.resize(240, 90) self.label.move(40, 30) self.label.thisown = 0 self.label.pack() # -- window self.window = adonthell.win_container() self.window.move(0, 0) self.window.resize(320, 240) self.window.set_visible_border(0) self.window.set_trans_background(1) self.window.add(self.black) self.window.add(self.label) self.window.set_activate(1) self.window.set_visible_all(1) # -- audio adonthell.audio_fade_out_background(500) # -- misc stuff self.step = 0 # -- for the extro control self.a1 = 0 self.a2 = 0 self.a3 = 0 # -- for the forest animation control self.index = 0 # -- index in the typeover array self.delay = 0 # -- delay before adding new text self.cursor = 0 # -- cursor in the typeover text self.x = [0, 0, 0] # -- offsets of the 3 forest pics and Alek adonthell.gamedata_engine().set_update_map(0) self.letsexit = 0 adonthell.gametime_update() while self.letsexit != 1: for i in range(0, adonthell.gametime_frames_to_skip()): self.forest_animation() self.alek_run.update() self.window.update() adonthell.gametime_update() if self.letsexit != 1: self.window.draw() adonthell.screen_show() adonthell.gamedata_engine().main(self.window, 'fmv') # -- quit! adonthell.audio_fade_out_background(500) adonthell.gamedata_engine().main_quit()
def show_niche(self): if self.step == 0 and self.bubble == None: self.step = 1 self.index = self.index + 1 # -- "... well hidden and ..." self.bubble = self.make_bubble() # -- fade closed bag in elif self.step == 1: self.c_bag.set_alpha(1) self.c_bag.set_visible(1) self.window.add(self.c_bag) self.step = self.step + 1 elif self.step > 1 and self.step <= 255: self.c_bag.set_alpha(self.step) self.step = self.step + 1 return # -- fading done elif self.step == 256: self.window.remove(self.chest) self.window.remove(self.wall) del self.chest del self.wall self.step = 257 elif self.step > 256 and self.step <= 306: self.step = self.step + 1 return elif self.step == 307 and self.bubble == None: self.step = 308 self.index = self.index + 1 # -- "Right Here" self.bubble = self.make_bubble() # -- fade in open bag elif self.step == 308: self.o_bag.set_alpha(3) self.o_bag.set_visible(1) self.window.add(self.o_bag) self.step = self.step + 1 elif self.step > 308 and self.step <= 561: self.o_bag.set_alpha(self.step - 307) self.step = self.step + 1 # -- wait a little elif self.step > 561 and self.step <= 650: self.step = self.step + 1 # -- zoom to bjarn's face elif self.step == 651: # -- audio adonthell.audio_load_background(1, "audio/at-demo-a.ogg") adonthell.audio_play_background(1) self.bjarn.set_visible(1) self.window.add(self.bjarn) self.window.remove(self.c_bag) self.window.remove(self.o_bag) del self.c_bag del self.o_bag self.step = 652 self.index = self.index + 1 # -- "But ..." self.bubble = self.make_bubble() elif self.step == 652 and self.bubble == None: self.step = 653 self.index = self.index + 1 # -- "... they are gone" self.bubble = self.make_bubble() # -- wait a little more elif self.step > 652 and self.step <= 850: if self.bubble == None: self.step = self.step + 1 elif self.step == 851: if self.bubble != None: adonthell.win_manager_get_active().remove(self.bubble) self.bubble = None adonthell.gamedata_engine().main_quit() adonthell.gamedata_player().set_schedule_active(1) self.done = 0 self.index = 25
def show_niche (self): if self.step == 0 and self.bubble == None: self.step = 1 self.index = self.index + 1 # -- "... well hidden and ..." self.bubble = self.make_bubble () # -- fade closed bag in elif self.step == 1: self.c_bag.set_alpha (1) self.c_bag.set_visible (1) self.window.add (self.c_bag) self.step = self.step + 1 elif self.step > 1 and self.step <= 255: self.c_bag.set_alpha (self.step) self.step = self.step + 1 return # -- fading done elif self.step == 256: self.window.remove (self.chest) self.window.remove (self.wall) del self.chest del self.wall self.step = 257 elif self.step > 256 and self.step <= 306: self.step = self.step + 1 return elif self.step == 307 and self.bubble == None: self.step = 308 self.index = self.index + 1 # -- "Right Here" self.bubble = self.make_bubble () # -- fade in open bag elif self.step == 308: self.o_bag.set_alpha (3) self.o_bag.set_visible (1) self.window.add (self.o_bag) self.step = self.step + 1 elif self.step > 308 and self.step <= 561: self.o_bag.set_alpha (self.step - 307) self.step = self.step + 1 # -- wait a little elif self.step > 561 and self.step <= 650: self.step = self.step + 1 # -- zoom to bjarn's face elif self.step == 651: # -- audio adonthell.audio_load_background (1, "audio/at-demo-a.ogg") adonthell.audio_play_background (1) self.bjarn.set_visible (1) self.window.add (self.bjarn) self.window.remove (self.c_bag) self.window.remove (self.o_bag) del self.c_bag del self.o_bag self.step = 652 self.index = self.index + 1 # -- "But ..." self.bubble = self.make_bubble () elif self.step == 652 and self.bubble == None: self.step = 653 self.index = self.index + 1 # -- "... they are gone" self.bubble = self.make_bubble () # -- wait a little more elif self.step > 652 and self.step <= 850: if self.bubble == None: self.step = self.step + 1 elif self.step == 851: if self.bubble != None: adonthell.win_manager_get_active ().remove (self.bubble) self.bubble = None adonthell.gamedata_engine ().main_quit () adonthell.gamedata_player ().set_schedule_active (1) self.done = 0 self.index = 25
def show_menu(self, a, b): menu = main_menu.main_menu(a, b) # -- open the menu adonthell.gamedata_engine().main(menu, "game_menu") # -- once the menu is closed, see what we got retval = menu.get_result() # -- start new game if retval == 1: # -- let the player chose a name for his character import character_screen cs = character_screen.character_screen() adonthell.gamedata_engine().main(cs, "character_screen") adonthell.gamedata_engine().fade_out() self.cleanup() # -- load the initial game adonthell.gamedata_load(0) adonthell.gamedata_player().set_name(cs.name) # -- on to the intro self.play_intro() # -- Load game elif retval == 2: adonthell.gamedata_player().set_schedule_active(1) self.window.set_visible(0) self.cleanup() adonthell.gamedata_engine().mapview_start() adonthell.gamedata_engine().set_control_active(1) adonthell.gamedata_engine().fade_in() # -- quit the game else: adonthell.gamedata_engine().main_quit() adonthell.win_container.__del__(menu)
def fade_to_forest (self): # -- drawing area self.da = adonthell.drawing_area () self.da.resize (adonthell.screen_length (), adonthell.screen_height ()) self.da.move (0, 0) # -- load images self.wood1 = adonthell.image () self.wood1.load_raw ("gfx/cutscene/forest3.img") self.wood2 = adonthell.image () self.wood2.load_raw ("gfx/cutscene/forest2.img") self.wood2.set_mask (1) self.wood3 = adonthell.image () self.wood3.load_raw ("gfx/cutscene/forest1.img") self.wood3.set_mask (1) self.alek_run = adonthell.animation () self.alek_run.load ("gfx/cutscene/running_alek.anim") self.alek_run.play () self.black = adonthell.win_image () self.black.resize (320, 240) self.black.fillrect (0, 0, 320, 240, 0) self.black.thisown = 0 self.black.pack () # -- label self.label = adonthell.win_label () self.label.set_font (adonthell.win_manager_get_font ("white")) self.label.resize (240, 90) self.label.move (40, 30) self.label.thisown = 0 self.label.pack () # -- window self.window = adonthell.win_container () self.window.move (0, 0) self.window.resize (320, 240) self.window.set_visible_border (0) self.window.set_trans_background (1) self.window.add (self.black) self.window.add (self.label) self.window.set_activate (1) self.window.set_visible_all (1) # -- audio adonthell.audio_fade_out_background (500) # -- misc stuff self.step = 0 # -- for the extro control self.a1 = 0 self.a2 = 0 self.a3 = 0 # -- for the forest animation control self.index = 0 # -- index in the typeover array self.delay = 0 # -- delay before adding new text self.cursor = 0 # -- cursor in the typeover text self.x = [0, 0, 0] # -- offsets of the 3 forest pics and Alek adonthell.gamedata_engine ().set_update_map (0) self.letsexit = 0 adonthell.gametime_update () while self.letsexit != 1: for i in range (0, adonthell.gametime_frames_to_skip ()): self.forest_animation () self.alek_run.update () self.window.update () adonthell.gametime_update () if self.letsexit != 1: self.window.draw () adonthell.screen_show () adonthell.gamedata_engine ().main (self.window, 'fmv') # -- quit! adonthell.audio_fade_out_background (500) adonthell.gamedata_engine ().main_quit ()
def on_enter(self): self.name = self.entry.text_char() adonthell.gamedata_engine().main_quit()
def run(self, submap, x, y, dir, name): adonthell.gamedata_engine ().get_landmap ().get_mapobject (0).\ get_animation (0).next_frame ()