예제 #1
0
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, 'delete', player.delete)
예제 #2
0
def create_player(x=0, y=0):
	_player = ships.create_energy_ship(x=x, y=y)
	_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'], min_zoom=5, max_zoom=14, max_enemy_distance=10000, center_distance=5000)
	entities.register_event(_player, 'delete', player.delete)
	entities.register_event(_player, 'hit_edge', lambda entity: entities.trigger_event(entity, 'hit', damage=100))
	entities.trigger_event(_player, 'push', velocity=(30, 30))
예제 #3
0
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))
예제 #4
0
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))