Skip to content

PopochiuRoom

Carenalga edited this page Feb 7, 2023 · 9 revisions

icon_room-x4

Description

Inherits from YSort.

Rooms are the scenes in Popochiu. They can have: Walkable areas, Props, Hotspots, Regions and Points. Characters can move through them and interact with their Props and Hotspots. Regions can be used to trigger methods when a character enters or leaves.

Properties

Export

  • has_player bool. Default true. Indicates Popochiu if this room should add the Player-controlled Character to its Characters node.
  • hide_gi bool. Default false. Use it to hide the graphic interface when in this room. Useful for cutscenes, splash screens and menus.
  • limit_bottom int. Default INF. Defines the bottom (down) limit of the camera relative to the size of the game window. Use this on rooms that are bigger than the game window to make Popochiu know where the camera should start moving.
  • limit_left int. Default INF. Defines the left limit of the camera relative to the size of the game window. Use this on rooms that are bigger than the game window to make Popochiu know where the camera should start moving.
  • limit_right int. Default INF. Defines the right limit of the camera relative to the size of the game window. Use this on rooms that are bigger than the game window to make Popochiu know where the camera should start moving.
  • limit_top int. Default INF. Defines the top (up) limit of the camera relative to the size of the game window. Use this on rooms that are bigger than the game window to make Popochiu know where the camera should start moving.
  • script_name String. The identifier of the room used in scripts.

Public

  • characters_cfg Array. Stores dictionaries with the info about each PopochiuCharacter position inside the room when it is added to the tree. Used by Popochiu to know where to place, inside the room, the global instances of each character.
  • is_current bool. true if this is the room in which players are.

Private

  • _moving_character PopochiuCharacter. The instance of the current character that is moving around the room.
  • _nav_path PopochiuWalkableArea. The active PopochiuWalkableArea that characters can move through.
  • _path Array. The points of the created path to follow when the player-controlled character is moving through the room.

Methods

Virtual

🍑 You can take a look on examples of what to do on each of this methods in the Room page of Your scripts section.

  • on_room_entered() void

    What happens when Popochiu loads the room. At this point the room is in the tree but it is not visible.

  • on_entered_from_editor() void

    Not working yet.

  • on_room_exited() void

    What happens before Popochiu unloads the room. At this point the room is inside the tree but it is not visible, it is not processing, and has no childs in the Characters node.

  • on_room_transition_finished() void

    What happens when the room changing transition finishes. At this point the room is visible.

Public

  • add_character( PopochiuCharacter chr ) void

    Adds a global PopochiuCharacter to the Characters node and connects to their started_walk_to and stoped_walk signals.

  • exit_room() void

    Called by Popochiu when moving to another room, and before removing this room from the tree. It stops this room' processing, removes the global instances of the characters from it, and calls on_room_exited().

  • has_character( String character_name ) bool

    Looks for a PopochiuCharacter inside its Characters child.

  • hide_props() void

    Hides all the nodes inside its Props child.

  • remove_character( PopochiuCharacter chr ) void

    Removes (without destroying it) a global PopochiuCharacter from the Characters node.

  • setup_camera() void

    Called by Popochiu when loading the room to make the camera follow the limits of this room's camera setup.

Set and get

Private

  • _clear_navigation_path() void

    Clears the path being used by a character to move from one point to another, and makes the character to idle.

  • _move_along_path( float distance ) void

    Makes a character moves along the path calculated inside a PopochiuWalkableArea from the position where the character is and the position where a click in the room was registered.

  • _update_navigation_path( PopochiuCharacter character, Vector2 start_position, Vector2 end_position ) void

    Determines the path to use when moving a character inside the room. If the character is ignoring walkable areas (PopochiuCharacter.ignore_walkable_areas == true), the path will be a line between the character´s position and the position where the click was registered, otherwise it will be the shortest path inside the active PopochiuWalkableArea from the character´s position to the position inside the walkable area where the click was registered.

Clone this wiki locally