Exemple #1
0
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)
Exemple #2
0
def loop_attract():
	global TRANSITION_PAUSE, LEVEL
	
	if not entities.get_entity_group('enemies') or not entities.get_entity_group('hazards'):
		if TRANSITION_PAUSE:
			TRANSITION_PAUSE -= 1
		else:
			TRANSITION_PAUSE = 80
			clean()
			LEVEL = 3
			spawn_enemies()
Exemple #3
0
def loop_attract():
    global TRANSITION_PAUSE, LEVEL

    if not entities.get_entity_group(
            'enemies') or not entities.get_entity_group('hazards'):
        if TRANSITION_PAUSE:
            TRANSITION_PAUSE -= 1
        else:
            TRANSITION_PAUSE = 80
            clean()
            LEVEL = 3
            spawn_enemies()
Exemple #4
0
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)
Exemple #5
0
def action_camera():
	global CAMERA_TIME, CAMERA_MODE
	
	if CAMERA_MODE == 'hover':
		display.CAMERA['next_center_on'] = numpy.array([worlds.get_size()[0]/2, worlds.get_size()[1]/2])
		display.CAMERA['next_zoom'] = 5.0
	
	elif CAMERA_MODE == 'follow':
		_focus_on = entities.get_entity_group('enemies')
		
		if not _focus_on:
			_focus_on = entities.get_entity_group('hazards')
		
		display.CAMERA['next_center_on'] = entities.get_entity(_focus_on[0])['position'].copy()
		display.CAMERA['next_zoom'] = 2.5
	
	CAMERA_TIME -= 1
	
	if not CAMERA_TIME:
		CAMERA_MODE = random.choice(CAMERA_MODES)
		CAMERA_TIME = random.randint(120, 200)
Exemple #6
0
def loop():
	global TRANSITION_PAUSE, ANNOUNCE, NOTERIETY
	
	if entities.get_entity_group('players') and not entities.get_entity_group('enemies') and not entities.get_entity_group('hazards'):
		if TRANSITION_PAUSE:
			if ANNOUNCE:
				ANNOUNCE = False
				
				display.print_text(display.get_window_size()[0]/2,
				                   display.get_window_size()[1]*.95,
				                   'WAVE CLEARED',
				                   color=(200, 200, 200, 255),
				                   text_group='bot_center',
				                   show_for=2,
				                   center=True)
			
			TRANSITION_PAUSE -= 1
			
			return False
		
		NOTERIETY += LEVEL
		spawn_enemies()
Exemple #7
0
def loop():
    global TRANSITION_PAUSE, ANNOUNCE, NOTERIETY

    if entities.get_entity_group('players') and not entities.get_entity_group(
            'enemies') and not entities.get_entity_group('hazards'):
        if TRANSITION_PAUSE:
            if ANNOUNCE:
                ANNOUNCE = False

                display.print_text(display.get_window_size()[0] / 2,
                                   display.get_window_size()[1] * .95,
                                   'WAVE CLEARED',
                                   color=(200, 200, 200, 255),
                                   text_group='bot_center',
                                   show_for=2,
                                   center=True)

            TRANSITION_PAUSE -= 1

            return False

        NOTERIETY += LEVEL
        spawn_enemies()
Exemple #8
0
def clean():
	for ship_id in entities.get_entity_group('players'):
		entities.delete_entity(entities.ENTITIES[ship_id])
	
	for ship_id in entities.get_entity_group('enemies'):
		entities.delete_entity(entities.ENTITIES[ship_id])	
	
	for ship_id in entities.get_entity_group('hazards'):
		entities.delete_entity(entities.ENTITIES[ship_id])
	
	for ship_id in entities.get_entity_group('effects'):
		entities.delete_entity(entities.ENTITIES[ship_id])
	
	for ship_id in entities.get_entity_group('bullets'):
		entities.delete_entity(entities.ENTITIES[ship_id])
	
	for ship_id in entities.get_entity_group('weapons'):
		entities.delete_entity(entities.ENTITIES[ship_id])
	
	entities.reset()
Exemple #9
0
def clean():
    global LEVEL

    LEVEL = 1

    for ship_id in entities.get_entity_group('players'):
        entities.delete_entity(entities.ENTITIES[ship_id])

    for ship_id in entities.get_entity_group('enemies'):
        entities.delete_entity(entities.ENTITIES[ship_id])

    for ship_id in entities.get_entity_group('hazards'):
        entities.delete_entity(entities.ENTITIES[ship_id])

    for ship_id in entities.get_entity_group('effects'):
        entities.delete_entity(entities.ENTITIES[ship_id])

    for ship_id in entities.get_entity_group('bullets'):
        entities.delete_entity(entities.ENTITIES[ship_id])

    for ship_id in entities.get_entity_group('weapons'):
        entities.delete_entity(entities.ENTITIES[ship_id])

    entities.reset()