Skip to content

PopochiuRoom

Carenalga edited this page Nov 27, 2022 · 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

  • script_name String. The identifier of the room used in scripts.
  • has_player bool. Default true. Indicated to Popochiu if this room should add the Playable 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_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.
  • 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.

Public

  • is_current bool. true if this is the room in which players are.
  • 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.

Private

  • _path Array. The points of the created path to follow when the playable character is moving through the room.
  • _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.

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_room_transition_finished() void

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

  • 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_entered_from_editor() void

    Not working yet.

Public

  • 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().

  • add_character( PopochiuCharacter chr ) void

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

  • remove_character( PopochiuCharacter chr ) void

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

  • hide_props() void

    Hides all the nodes inside its Props child.

  • has_character( String character_name ) bool

    Looks for a PopochiuCharacter inside its Characters child.

  • 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

  • _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.

  • _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.

Clone this wiki locally