Exemple #1
0
def create_player(character_config, entity_id=None):
    # first verify that we have a valid entity and
    # entity_id for this player
    if not entity_id:
        entity = factory.create_entity()
        entity_id = entity.entity_id
    else:
        entity = factory.get_entity(entity_id)
    # start pulling values off of the config
    char = character_config['character']
Exemple #2
0
def create_player(character_config, entity_id=None):
    # first verify that we have a valid entity and
    # entity_id for this player
    if not entity_id:
        entity = factory.create_entity()
        entity_id = entity.entity_id
    else:
        entity = factory.get_entity(entity_id)
    # start pulling values off of the config
    char = character_config['character']
Exemple #3
0
exe = execute.ExecutionSystem(factory)
eng.install_system(exe,
                   (ADDEXECUTIONCOMPONENT, REMOVEEXECUTIONCOMPONENT,
                    ACTIVATEEXECUTIONCOMPONENT, DEACTIVATEEXECUTIONCOMPONENT))

deb = debug.DebugSystem(screen, factory)
eng.install_system(
    deb, (ADDDEBUGCOMPONENT, REMOVEDEBUGCOMPONENT, UPDATEDEBUGCOMPONENT,
          ACTIVATEDEBUGCOMPONENT, DEACTIVATEDEBUGCOMPONENT))

pla = player.PlayerSystem(factory)
eng.install_system(pla,
                   (ADDPLAYERCOMPONENT, REMOVEPLAYERCOMPONENT, MOVEDEACTIVATE))

# input test object
player_entity = factory.create_entity()
t_entity = factory.create_entity()
player_bindings = {
    'up': pygame.K_UP,
    'down': pygame.K_DOWN,
    'left': pygame.K_LEFT,
    'right': pygame.K_RIGHT,
    'lp': pygame.K_a
}
player_inp_component = factory.create_component(
    'input',
    device=-1,
    entity_id=player_entity.entity_id,
    bindings=player_bindings)

# text test object
Exemple #4
0
exe = execute.ExecutionSystem(factory)
eng.install_system(exe, (ADDEXECUTIONCOMPONENT, REMOVEEXECUTIONCOMPONENT,
                         ACTIVATEEXECUTIONCOMPONENT,
                         DEACTIVATEEXECUTIONCOMPONENT))

deb = debug.DebugSystem(screen, factory)
eng.install_system(deb, (ADDDEBUGCOMPONENT, REMOVEDEBUGCOMPONENT,
                         UPDATEDEBUGCOMPONENT, ACTIVATEDEBUGCOMPONENT,
                         DEACTIVATEDEBUGCOMPONENT))

pla = player.PlayerSystem(factory)
eng.install_system(pla, (ADDPLAYERCOMPONENT, REMOVEPLAYERCOMPONENT,
                         MOVEDEACTIVATE))

# input test object
player_entity = factory.create_entity()
t_entity = factory.create_entity()
player_bindings = {
    'up': pygame.K_UP,
    'down': pygame.K_DOWN,
    'left': pygame.K_LEFT,
    'right': pygame.K_RIGHT,
    'lp': pygame.K_a
}
player_inp_component = factory.create_component('input', device=-1,
                                           entity_id=player_entity.entity_id,
                                           bindings=player_bindings)


# text test object
t_tex_comp = factory.create_component('text', entity_id=t_entity.entity_id,