Skip to content

PopochiuProp

Carenalga edited this page Feb 6, 2023 · 9 revisions

icon_prop-x4

Description

Inherits from PopochiuClickable.

Visual elements in the Room that can have interaction.

Editor

When selecting a Prop in the scene tree (Scene dock), Popochiu will enable two buttons in the Canvas menu: Baseline and Walk to point. This can be used to select the nodes that allow to modify the position of each node.

canvas_baseline_walk_to_point

Signals

  • linked_item_discarded( PopochiuInventoryItem node ). Emitted when the PopochiuInventoryItem linked to this object in link_to_item is discarded from the inventory (I.discard_item(...)). This may happen when the inventory item is thrown away, but it still can be grabbed and put in the inventory again.
  • linked_item_removed( PopochiuInventoryItem node ). Emitted when the PopochiuInventoryItem linked to this object in link_to_item is removed from the inventory (I.remove_item(...)). This may happen when the inventory item dissapears forever from the game.

Properties

Export

  • current_frame int. Default 0. The current frame to use as the texture of this node. Modifying this will change the value of the current_frame property in the $Sprite child. Trying to assign a value lesser than 0 will make this property to be 0, and trying to assign a value higher than the number of frames will make this property to be frames - 1.
  • frames int. Default 1. The number of frames this node's texture image has. Modifying this will change the value of the hframes property in the $Sprite child.
  • link_to_item String. Default ''. Links the prop to a PopochiuInventoryItem by its script_name. This will make the prop to dissapear from the room, depending on said inventory item is it or not inside the inventory.
  • texture Texture. Default null. The image to use as the texture of this node´s $Sprite.

Public

Nothing here yet.

Private

  • _sprite Sprite. Default $Sprite. A reference to the $Sprite child.

Methods

Virtual

🍑 For a detailed and exemplified description of all the virtual methods of this class (included those inherited from PopochiuClickable), go to the Your scripts > Prop page.

  • on_linked_item_discarded() void.

    Called when the PopochiuInventoryItem linked to the prop is discarded from the inventory (this may happen when the inventory item is thrown away, but it still can be grabbed and put in the inventory again). Can be used to define custom behaviors.

    See this in detail in Your scripts > Prop page.

  • on_linked_item_removed() void.

    Called when the PopochiuInventoryItem linked to the prop is removed from the inventory (this may happen when the inventory item dissapears forever from the game). Can be used to define custom behaviors.

    See this in detail in Your scripts > Prop page.

Public

  • change_frame( int new_frame ) void

    Changes the value of the current_frame property to new_frame when queuing instructions inside an E.run() call. Can be yield.

Set and get

  • set_current_frame( int value ) void

    Updates the current_frame property of the $Sprite child to value.

  • set_frames( int value ) void

    Updates the hframes property of the $Sprite child to value.

  • set_texture( Texture value ) void

    Updates the texture property of the $Sprite child to value.

Private

  • _on_item_added( PopochiuInventoryItem item, bool _animate ) void

    Called when the item_added signal from singleton I is emitted. This checks if the added item was the one linked to this prop to disable itself.

  • _on_item_discarded( PopochiuInventoryItem item ) void

    Called when the item_discarded signal from singleton I is emitted. This checks if the discarded item was the one linked to this prop to enable itself.

  • _on_item_removed( PopochiuInventoryItem item, bool _animate ) void

    Called when the item_removed signal from singleton I is emitted.

Clone this wiki locally