-
-
Notifications
You must be signed in to change notification settings - Fork 19
PopochiuRoom
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.
-
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.
- 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.
- _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.
🍑 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.
-
add_character( PopochiuCharacter
chr
) voidAdds a global PopochiuCharacter to the Characters node and connects to their
started_walk_to
andstoped_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
) boolLooks for a PopochiuCharacter inside its Characters child.
-
hide_props() void
Hides all the nodes inside its Props child.
-
remove_character( PopochiuCharacter
chr
) voidRemoves (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.
-
get_active_walkable_area() PopochiuWalkableArea
Returns the active PopochiuWalkableArea. That is the one that characters are currently able to navigate.
-
get_active_walkable_area_name() String
Returns the
name
of the active PopochiuWalkableArea. -
get_characters_count() int
Returns the number of childs inside the
$Characters
node. -
get_hotspot( String
hotspot_name
) PopochiuHotspotReturns the PopochiuHotspot inside the "hotspots" group which
script_name
matcheshotspot_name
. -
get_hotspots() Array
Returns all the PopochiuHotspots inside the "hotspots" group.
-
get_point( String
point_name
) Vector2Returns the global position of the Position2D node inside
$Points
whichname
is equal topoint_name
. ReturnsVector2D.ZERO
if the node doesn't exists. -
get_points() Array
Returns all the Position2D inside the
$Points
child. -
get_prop( String
prop_name
) PopochiuPropReturns the PopochiuProp inside the "props" group which
script_name
matchesprop_name
. -
get_props() Array
Returns all the PopochiuProps inside the "props" group.
-
get_region( String
region_name
) PopochiuRegionReturns the PopochiuRegion inside the "regions" group which
script_name
matchesregion_name
. -
get_regions() Array
Returns all the PopochiuRegions inside the "regions" group.
-
get_walkable_area( String
walkable_area_name
) PopochiuWalkableAreaReturns the PopochiuWalkableArea inside the "walkable_areas" group which
script_name
matcheswalkable_area_name
. -
get_walkable_areas() Array
Returns all the PopochiuWalkableAreas inside the "walkable_areas" group.
-
set_active_walkable_area( String
walkable_area_name
) voidMakes the PopochiuWalkableArea which
name
matcheswalkable_area_name
the active walkable area.**** -
set_is_current( bool
value
) voidEnables this room to listen for unhandled inputs when this is Popochiu´s current room.
-
_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
) voidMakes 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
, Vector2start_position
, Vector2end_position
) voidDetermines 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.