def blackout(count): state.myscene.blackout = True if count > 0: count = count - 1 pyglet.clock.schedule_once(make_dt_wrapper(show_stanislav_bag), 1.4, count) else: pyglet.clock.schedule_once(make_dt_wrapper(stanislav_gone), 3)
def potato_roll(actor, point): point_match = re.search(r"potato_(\d+)", point) if point_match and not state.myscene.global_dict['potato_stop']: current_index = int(point_match.group(1)) next_index = current_index + 1 if next_index > 40: next_index = 1 next_point = "potato_%d" % next_index print "Potato rolling from %s to %s" % (point, next_point) pyglet.clock.schedule_once(make_dt_wrapper(actor.prepare_walkpath_move), 0, next_point) pyglet.clock.schedule_once(make_dt_wrapper(actor.next_action), 0)
def potato_drop(actor, point): if point == "potato_drop_end": squeak_snd = pyglet.resource.media("sound/squeak.wav", streaming=False) squeak_snd.play() actor.walk_speed = 200 # stanislav is surprised at the critter pyglet.clock.schedule_once(make_dt_wrapper(state.myscene.begin_conversation), 1, "a_visitor") actor.update_state("run_note_4") if point == "shake_4": actor.prepare_walkpath_move("potato_exit") pyglet.clock.schedule_once(make_dt_wrapper(actor.next_action), 3) actor.update_state("run_4")
def potato_drop(actor, point): if point == "potato_drop_end": squeak_snd = pyglet.resource.media('sound/squeak.wav', streaming=False) squeak_snd.play() actor.walk_speed = 200 #stanislav is surprised at the critter pyglet.clock.schedule_once(make_dt_wrapper(state.myscene.begin_conversation), 1, "a_visitor") actor.update_state('run_note_4') if point == "shake_4": actor.prepare_walkpath_move('potato_exit') pyglet.clock.schedule_once(make_dt_wrapper(actor.next_action), 3) actor.update_state('run_4')
def kidnap_stanislav(): count = 2 def show_stanislav_bag(count): state.myscene.blackout = False pyglet.clock.schedule_once(make_dt_wrapper(blackout), 0.2, count) def blackout(count): state.myscene.blackout = True if count > 0: count = count - 1 pyglet.clock.schedule_once(make_dt_wrapper(show_stanislav_bag), 1.4, count) else: pyglet.clock.schedule_once(make_dt_wrapper(stanislav_gone), 3) state.myscene.fade_music(0) state.myscene.blackout = True pos = (state.myscene.actors['stanislav'].abs_position_x(), state.myscene.actors['stanislav'].abs_position_y()) state.myscene.remove_actor('stanislav') state.myscene.remove_actor('sneaky_bastard_1') scream_snd = pyglet.resource.media('sound/scream.wav', streaming=False) scream_snd.play() pyglet.clock.schedule_once(make_dt_wrapper(show_stanislav_bag), 2, count)
def handle_thermostat(): if state.myscene.handler.handler.game_variables['temperature'] >= 80: state.myscene.actors['thermostat'].update_state('rising') # Nicole complains! tourist = state.myscene.actors['tourist'] pyglet.clock.schedule_once(make_dt_wrapper(tourist.prepare_walkpath_move), 5, "tourist_complain") pyglet.clock.schedule_once(tourist.next_action, 5)
def levity_walk(actor, point): print "Walk handler called..." levity = state.myscene.actors['levity'] next_point = point if point == "levity_left" or point == "levity_right": if point == "levity_left": state.myscene.global_dict['levity_direction'] = 'right' next_point = "levity_1" elif point == "levity_right": state.myscene.global_dict['levity_direction'] = 'left' next_point = "levity_4" #levity.prepare_walkpath_move(next_point) pyglet.clock.schedule_once(make_dt_wrapper(levity.prepare_walkpath_move), 1, next_point) pyglet.clock.schedule_once(levity.next_action, 60) else: if point == "levity_1": next_point = "levity_2" if state.myscene.global_dict['levity_direction'] == "right" else "levity_left" elif point == "levity_2": next_point = "levity_3" if state.myscene.global_dict['levity_direction'] == "right" else "levity_1" elif point == "levity_3": next_point = "levity_4" if state.myscene.global_dict['levity_direction'] == "right" else "levity_2" elif point == "levity_4": if state.myscene.global_dict.get('levity_exposition', False) == False: state.myscene.global_dict['levity_exposition'] = True #begin convo actor.update_state("stand_right") state.myscene.begin_conversation("introduction") else: next_point = "levity_right" if state.myscene.global_dict['levity_direction'] == "right" else "levity_3" if next_point is not point: levity.prepare_walkpath_move(next_point) print "Moving from %s to %s..." % (point, next_point)
def ball_drop(): #pause for a moment, then shake it off state.myscene.actors['potato_drop'].prepare_walkpath_move('shake_4') pyglet.clock.schedule_once( make_dt_wrapper(state.myscene.actors['potato_drop'].next_action), 3) state.myscene.actors['potato_drop'].update_state('run') state.myscene.begin_conversation('surprise_note')
def stanislav_loves_inga(): x = state.myscene.actors['main'].abs_position_x() y = state.myscene.actors['main'].abs_position_y() interp = Linear2DInterpolator(state.myscene.camera, 'position', (x, y), speed=400.0, done_function=make_dt_wrapper(inga_to_stanny)) state.myscene.add_interpolator(interp)
def queue_need_a_smoke(): def begin_smoke_conv(): myscene.begin_conversation("need_a_smoke") state.start_cutscene() interp = Linear2DInterpolator(myscene.camera, 'position', (0.0, 360.0), start_tuple=(1920,360), speed=400.0, done_function=util.make_dt_wrapper(begin_smoke_conv)) myscene.add_interpolator(interp)
def stanislav_loves_inga(): stan = state.myscene.actors['stanislav'] stan.update_state('stand_front') stan.walkpath_point = 's_stand' x = state.myscene.actors['main'].abs_position_x() y = state.myscene.actors['main'].abs_position_y() interp = Linear2DInterpolator(state.myscene.camera, 'position', (x, y), speed=400.0, done_function=make_dt_wrapper(inga_to_stanny)) state.myscene.add_interpolator(interp)
def handle_thermostat(): if state.myscene.handler.handler.game_variables['temperature'] >= 80: state.myscene.actors['thermostat'].update_state('rising') # Nicole complains! tourist = state.myscene.actors['tourist'] pyglet.clock.schedule_once( make_dt_wrapper(tourist.prepare_walkpath_move), 5, "tourist_complain") pyglet.clock.schedule_once(tourist.next_action, 5)
def return_to_inga(): x = state.myscene.actors['main'].abs_position_x() y = state.myscene.actors['main'].abs_position_y() interp = Linear2DInterpolator(state.myscene.camera, 'position', (x, y), speed=400.0, done_function=make_dt_wrapper( state.end_cutscene)) state.myscene.add_interpolator(interp)
def inspect_duct(): state.start_cutscene() interp = Linear2DInterpolator( state.myscene.camera, 'position', (0.0, 360.0), start_tuple=(1920, 360), speed=400.0, done_function=make_dt_wrapper(return_to_inga)) state.myscene.add_interpolator(interp)
def stanislav_loves_inga(): stan = state.myscene.actors['stanislav'] stan.update_state('stand_front') stan.walkpath_point = 's_stand' x = state.myscene.actors['main'].abs_position_x() y = state.myscene.actors['main'].abs_position_y() interp = Linear2DInterpolator( state.myscene.camera, 'position', (x, y), speed=400.0, done_function=make_dt_wrapper(inga_to_stanny)) state.myscene.add_interpolator(interp)
def queue_need_a_smoke(): def begin_smoke_conv(): myscene.begin_conversation("need_a_smoke") state.start_cutscene() interp = Linear2DInterpolator( myscene.camera, 'position', (0.0, 360.0), start_tuple=(1920, 360), speed=400.0, done_function=util.make_dt_wrapper(begin_smoke_conv)) myscene.add_interpolator(interp)
def potato_adventure(): state.myscene.ui.inventory.get_item('potato_note') def potato_drop(): potato = state.myscene.actors['potato_drop'] potato.walk_speed = 800 potato.prepare_walkpath_move('potato_drop_end') potato.next_action() state.start_cutscene() interp = Linear2DInterpolator(state.myscene.camera, 'position', (0.0, 360.0), start_tuple=(1920,360), speed=400.0, done_function=make_dt_wrapper(potato_drop)) state.myscene.add_interpolator(interp)
def potato_adventure(): state.myscene.ui.inventory.get_item('potato_note') def potato_drop(): potato = state.myscene.actors['potato_drop'] potato.walk_speed = 800 potato.prepare_walkpath_move('potato_drop_end') potato.next_action() state.start_cutscene() interp = Linear2DInterpolator(state.myscene.camera, 'position', (0.0, 360.0), start_tuple=(1920, 360), speed=400.0, done_function=make_dt_wrapper(potato_drop)) state.myscene.add_interpolator(interp)
def show_stanislav_bag(count): state.myscene.blackout = False state.myscene.play_sound("lights_out") pyglet.clock.schedule_once(make_dt_wrapper(blackout), 0.2, count)
def ball_drop(): #pause for a moment, then shake it off state.myscene.actors['potato_drop'].prepare_walkpath_move('shake_4') pyglet.clock.schedule_once(make_dt_wrapper(state.myscene.actors['potato_drop'].next_action), 3) state.myscene.actors['potato_drop'].update_state('run') state.myscene.begin_conversation('surprise_note')
def return_to_inga(): x = state.myscene.actors['main'].abs_position_x() y = state.myscene.actors['main'].abs_position_y() interp = Linear2DInterpolator(state.myscene.camera, 'position', (x, y), speed=400.0, done_function=make_dt_wrapper(state.end_cutscene)) state.myscene.add_interpolator(interp)
def inspect_duct(): state.start_cutscene() interp = Linear2DInterpolator(state.myscene.camera, 'position', (0.0, 360.0), start_tuple=(1920,360), speed=400.0, done_function=make_dt_wrapper(return_to_inga)) state.myscene.add_interpolator(interp)
def show_stanislav_bag(count): state.myscene.blackout = False pyglet.clock.schedule_once(make_dt_wrapper(blackout), 0.2, count)