PopochiuProp - carenalgas/popochiu GitHub Wiki

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.

Signals
- linked_item_discarded( PopochiuInventoryItem
node). Emitted when the PopochiuInventoryItem linked to this object inlink_to_itemis 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 inlink_to_itemis 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 thecurrent_frameproperty in the$Spritechild. 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 beframes - 1. - frames int. Default
1. The number of frames this node's texture image has. Modifying this will change the value of thehframesproperty in the$Spritechild. - link_to_item String. Default
''. Links the prop to a PopochiuInventoryItem by itsscript_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 thetextureof this node´s$Sprite.
Public
Nothing here yet.
Private
- _sprite Sprite. Default
$Sprite. A reference to the$Spritechild.
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) voidChanges the value of the
current_frameproperty tonew_framewhen queuing instructions inside anE.run()call. Can be yield.
Set and get
-
set_current_frame( int
value) voidUpdates the
current_frameproperty of the$Spritechild tovalue. -
set_frames( int
value) voidUpdates the
hframesproperty of the$Spritechild tovalue. -
set_texture( Texture
value) voidUpdates the
textureproperty of the$Spritechild tovalue.
Private
-
_on_item_added( PopochiuInventoryItem
item, bool_animate) voidCalled when the
item_addedsignal 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) voidCalled when the
item_discardedsignal 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) voidCalled when the
item_removedsignal from singleton I is emitted.