def delete(entity): time.sleep(.75) display.clear_text_group('bot_center') #TODO: Let menu take over display.CAMERA['zoom_speed'] = .09 display.CAMERA['next_zoom'] = 4.5 display.CAMERA['camera_move_speed'] = 0.02 #NOTERIETY -= entities.get_entity_group('enemies') events.unregister_event('camera', handle_camera) menu.setup_main_menu() _enemy_amount = len(entities.get_entity_group('enemies')) if _enemy_amount>=3: _loss_string = 'Pirates spread the news of your death...' elif _enemy_amount: _loss_string = 'People think a little less of you now...' else: _loss_string = 'Only the machines saw your death...' display.print_text(display.get_window_size()[0]/2, display.get_window_size()[1]*.25, _loss_string, text_group='bot_center', color=(255, 0, 0, 0), show_for=6, fade_in_speed=4, center=True)
def loop(): global CHANGE_WAVE_FIRE, TRANSITION_PAUSE, CHANGE_WAVE, WAVE_TIMER, LEVEL, WAVE if TRANSITION_PAUSE and CHANGE_WAVE: _player = entities.get_entity(entities.get_entity_group('players')[0]) if not CHANGE_WAVE_FIRE: entities.trigger_event(_player, 'create_timer', time=120, enter_callback=lambda entity: events.unregister_event('input', player.handle_input), callback=lambda entity: entities.trigger_event(entity, 'push', velocity=(6, 6)), exit_callback=lambda entity: display.camera_snap((-4000, -4000)) and entities.trigger_event(entity, 'set_position', x=-4000, y=-4000) and events.register_event('input', player.handle_input, _player['_id']) and create_planet()) LEVEL += 1 _player['NO_BOUNCE'] = True CHANGE_WAVE_FIRE = True if TRANSITION_PAUSE: TRANSITION_PAUSE -= 1 return False if CHANGE_WAVE: WAVE = 1 CHANGE_WAVE = False if not entities.get_entity_group('enemies') and not entities.get_entity_group('hazards') and WAVE_TIMER: WAVE_TIMER -= 4 if entities.get_entity_group('players') and WAVE_TIMER<=0 or (LEVEL == 2 and not entities.get_entity_group('enemies')): spawn_enemies() WAVE_TIMER = WAVE_TIMER_MAX+(60*WAVE)
def start_arena(weapon=None): display.clear_text_group('menu') display.clear_text_group('logo') display.clear_text_group('bot_center') events.unregister_event('input', control) events.unregister_event('loop', battlefield.loop_attract) events.unregister_event('camera', action_camera) events.register_event('loop', battlefield.loop) battlefield.clean() battlefield.create() display.CAMERA['camera_move_speed'] = 0.05
def start_career(): display.clear_text_group('menu') display.clear_text_group('logo') display.clear_text_group('bot_center') events.unregister_event('input', control) events.unregister_event('loop', battlefield.loop_attract) events.unregister_event('camera', action_camera) events.register_event('loop', levels.loop) battlefield.clean() levels.load_level() display.CAMERA['camera_move_speed'] = 0.05
def create_player(): _player = ships.create_energy_ship() _player['player'] = True player.register_entity(_player) events.register_event('input', player.handle_input, _player['_id']) events.register_event('camera', player.handle_camera, _player['_id']) entities.register_event(_player, 'score', player.score) entities.register_event(_player, 'delete', player.delete) entities.register_event(_player, 'kill', lambda entity: events.unregister_event('input', player.handle_input)) entities.register_event(_player, 'kill', lambda entity: display.print_text(display.get_window_size()[0]/2, display.get_window_size()[1]*.75, 'Awarded medal:', color=(255, 0, 0, 50), font_size=18, show_for=3.5, fade_in_speed=6, center=True))
def create_player(): _player = ships.create_energy_ship() _player['player'] = True player.register_entity(_player) events.register_event('input', player.handle_input, _player['_id']) events.register_event('camera', player.handle_camera, _player['_id']) entities.register_event(_player, 'score', player.score) entities.register_event(_player, 'delete', player.delete) entities.register_event( _player, 'kill', lambda entity: events.unregister_event('input', player.handle_input)) entities.register_event( _player, 'kill', lambda entity: display.print_text(display.get_window_size()[0] / 2, display.get_window_size()[1] * .75, 'Awarded medal:', color=(255, 0, 0, 50), font_size=18, show_for=3.5, fade_in_speed=6, center=True))