def portal(portal_id: PortalId):
     entity = create_portal(portal_id, (0, 0)).world_entity
     e = MapEditorWorldEntity(
         entity.sprite,
         (entity.pygame_collision_rect.w, entity.pygame_collision_rect.h))
     e.portal_id = portal_id
     return e
Example #2
0
def _add_portal(portal_id: PortalId, game_state, snapped_mouse_world_position):
    already_has_portal = any([
        x for x in game_state.portals
        if x.world_entity.get_position() == snapped_mouse_world_position
    ])
    if not already_has_portal:
        portal = create_portal(portal_id, snapped_mouse_world_position)
        game_state.portals.append(portal)
Example #3
0
 def deserialize(data) -> Portal:
     return create_portal(PortalId[data["portal_id"]], data["position"])