- Resolve ItemAdder with inventory full notification along with item receiver. Similiar to PickableItem.
- [ ]
{
Inventory: $Game/interface/interface/td/roomNav/cente/inventory/margin/items,
Used to manage item inside inventory and show it to player.
grabber: $Game/interface/floating/grab,
Used to drag and drop item.
losing_notification,winning_notification,get_item_notification,notify_full
All in $Game/interface/popups, self explanatory.
level_node
$Game/Level
The currently loaded level.
}
Access function via ResourceManager.objectList["Inventory"]
- void addItem( String
name, Textureicon)
Accessed by
PickableItemandItemAdderclass.
nameis what the item is called to help the game identify.
iconis item’s thumbnail shown in inventory.
- bool useItem( String
name)
Accessed by
ItemReceiverclass. Used to check if inventory had certain item. If yes return true, then item will be used. If no, return false and nothing else will happened.
- void removeItem( String
name)
Force remove an item. Only called by the node itself (not from outside).
Start from Inventory’s each item’s button. It’s item.tscn.
Inventory : $Game/interface/interface/td/roomNav/cente/inventory/margin/items,
properties:
grabber = ResourceManager.objectList["grabber"]
call grab() from grabber when item.tscn (which is Button) is pushed down.
<<
a.k.aResourceManager.objectList["grabber"] / interface/floating/grab / Mouse.gd
- void grab( Texture
texture, Stringitem_name)
Called when
item.tscn(button) is pushed down.
Show item icon’s texture. Then it will spawnitem_hover.tscninside $Game/Level. Which will follow mouse global position as long as it’s remain on scene.
- void drop()
Called when player just released the touch.
if (event is InputEventScreenTouch and !event.is_pressed())and isGrabbing:
drop()
This will delete
item_hover.tscnand spawnitem_dropper.tscninside $Game/Level.item_dropper.tscnwill check wether it touching ItemReceiver that will receive the item that just dropped or not. If yes it will calltrigger()on the said ItemReceiver. Then freed from the scene.
- void hide_item()
Item hover will follow mouse global position in each frame. At this state, player is dragging the mouse/touch.
Will check if item dropped into ItemReceiver or not then got freed.