Skip to content

PopochiuClickable

Carenalga edited this page Nov 30, 2022 · 7 revisions

Description

Inherits from Area2D.

Base class of the objects which players interact with inside rooms: Props, Hotspots and characters.

Properties

Export

  • always_on_top bool. Default false. Whether the object will be rendered always above other objects in the room.
  • baseline int. Default 0. The y position of the baseline relative to the center of the object..
  • clickable bool. Default true. Whether the object will listen to interactions.
  • cursor Cursor. Default Cursor.NONE. The texture to use when the cursor hovers the object.
  • description String. Default ''. The text shown to players when the cursor hovers the object.
  • script_name String. Default ''. The identifier of the object used in scripts.
  • walk_to_point Vector2. Default Vector2.ZERO. The position where characters will move when aproaching the object.

Public

  • room PopochiuRoom. Default null. The room to which the object belongs.

Private

  • _description_code String. Default ''. The code to use as the description of the object when using localization.

Methods

Virtual

  • on_interact() void

    Called when players INTERACT (click) with the object.

  • on_item_used( PopochiuInventoryItem item ) void

    Called when a PopochiuInventoryItem is used on the object.

  • on_look() void

    Called when players LOOK AT/EXAMINE (right click) the object.

  • on_room_set() void

    Called once the PopochiuRoom which this object belongs to finishes its _ready() call.

Public

  • disable( bool is_in_queue = true ) void

    Makes the object invisible, and consequently disables it from registering interactions.

  • enable( bool is_in_queue = true ) void

    Makes the object visible, and consequently enables it from registering interactions.

  • hide_helpers() void

    Used by the plugin to hide the visual helpers that show the baseline and walk_to_point of the object in Godot´s 2D Canvas.

  • show_helpers() void

    Used by the plugin to make visible the visual helpers that show the baseline and walk_to_point of the object in Godot´s 2D Canvas when a PopochiuClickable is selected in the scene tree.

Set and get

  • get_description() String

    Returns the description of the object passing it through E.get_text(), which can be used to show it in different languages when using localization.

  • get_walk_to_point() Vector2

    When running the game, returns the global position of the walk_to_point. When in the Editor, returns the value of the walk_to_point.

  • set_baseline( int value ) void

    When in the Editor, makes the $BaselineHelper child to be rendered in the Canvas showing a line where the baseline of this object is.

  • set_room( PopochiuRoom value ) void

    Calls on_room_set() when the room to which this object belongs is setted.

  • set_walk_to_point( Vector2 value ) void

    When in the Editor, makes the $WalkToHelper child to be rendered in the Canvas showing a Position2D where the walk_to_point of this object is.

Private

  • _toggle_description( bool display ) void

    Shows and hides (depending on the value of display) the description when the cursor hovers or leaves the object. When the cursor is over it takes into account the queue of hovered objects in Popochiu (E) to add itself to its head or tale depending on its relation to the other objects in the queue. The description shown by Popochiu will be always the object in the tale of the queue.

  • _toggle_input() void

    Calles when the visibility of the object changes. If it is clickable, then the input will be enabled or disabled Whether the object is or not visible.

  • _translate() void

    When the game is using localization, this changes the value of description to match the code used by the TranslationServer to show the text in the current language.

Clone this wiki locally