0.4 Demo, Inventory Access, and Interactable Objects


The latest update to the Item Drops plugin for Godot 4 introduces a mix of breaking changes, new features, and enhancements to streamline 2D game development. Key updates include renaming components for clarity (e.g., ItemDropsSignalBus to ItemDropsBus, Pickup to Pickup2D), shifting PickupsCollector to PickupsCollector2D with Area2D inheritance for simpler functionality, and replacing PackedScene references with @export_file strings to optimize memory and prevent recursion. Pickup2D now offers a delay option, sound slot, and toggle for delayed removal, enhanced by a new PickupAnimationPlayer for animations. New demo projects showcase sidescrolling and top-down mechanics, featuring tools like RandomDrops, InventoryDrops, and LaunchForceSceneSpawner2D, while additions like Interacter, Interactable2D, and resource settings (InventoryAccessSettings, SpawnGroup) enrich interactivity. Three new events (PickupEvent, GatherEvent, SpawnEvent) improve signal handling, partial inventory adds are now supported, and a bug fix ensures ShapeEdgeSceneSpawner works reliably, making this a robust update for creating dynamic item systems.
Breaking Changes
- ItemDropsSignalBus renamed to ItemDropsBus for name simplification
- PickupsCollector is now PickupsCollector2D and inherits from Area2D to combine functionality for simplicity's sake. The PickupsCollector2D is the area trigger that causes a pickup to occur to a character's inventory
- Pickup is now Pickup2D (extends Area2D). This can be either the root of a scene for simplest setup or a child node which works best if you need the root to have RigidBody2D physics. Also, the node is definitively a 2D node so if 3D is implemented in the future it will be a Pickup3D node in line with standard Godot classes.
- SpawnedMovesOnSpawnComponent is now MoveOnSpawn2D. It causes an objects spawned by a SceneSpawner to move on spawn.
- References to PackedScene have been replaced with @export_file strings and calls to load. This prevents recursion from happening in cases like a Pickup scene pointing to the pickup item resource and the resource then pointing back to the Pickup scene. It also keeps unnecessary objects from being loaded into memory before being needed. This will break references like the pickup item resource on each Pickup scene so be aware.
- GatherAudioPlayer2D - Removed. PickupsCollector2D handles this better by simply playing the sounds on the character that picked up the item.
Demo
- Created a 2D sidescrolling demo project that will be included alongside versions of the plugin. It demonstrates RandomDrops, InventoryDrops (system agnostic so you can use with outside systems), LaunchForceSceneSpawner2D (for launching RigidBody2D on spawn). It also has prototypes for simple platformer combat, state machines, and behavior trees (using LimboAI)
- Created a 2D top down gathering demo project. It demonstrates ShapeEdgeSceneSpawner, SpawnMoveInitializer2D, and most gathering classes (example, hit a node with a pickaxe to drop ore resources from an ore vein)
- Uses LimboAI Hierarchical State Machine with Behavior Tree Nodes for Player Characters and Enemies.
- You can reuse the code from the project following the same license agreement if you'd like.
Pickup2D
- Added an optional delay to being picked up (keeps monitorable false until the delay, if any, has elapsed)
- Added a slot for pickup sound, this should be plays on the AudioPlayer connected to the pickup character's PickupCollector2D node since the pickup disappears after being picked up. (Child sound nodes would be freed as well)
- Added a toggle for free_on_pickup to make immediately removal optional. If false, monitorable will be set false instead. This allows time for other scripts to execute like PickupAnimationPlayer.
PickupAnimationPlayer
- Adds an option to play an animation when picked_up event triggers off a Pickup2D rather than immediately removing it from the scene. Be sure free_on_pickup is false on the Pickup2D node.
What's New
- InventoryDrops - You can now use this to drop all or a select number of items from a inventory node.
- Interacter and Interactable2D - Use these to let a player character interact with nearby objects by pressing an interact action key. Included is AnimationToggleInteractable2D which is perfect for playing open / close animations on chests (for dropping loot!), doors, or switches.
- Resource settings for shared data InventoryAccessSettings and SpawnGroup. These will make it easy to define how to access the contents of an external inventory system and mark a node as the pickup parent node for all concerned objects in the game at one go.
Events Added
- PickupEvent - Created & Emitted in signals whenever a scene object is picked up from the game scene
- GatherEvent - Created & Emitted in signals whenever a Gatherable node is harvested successfully
- SpawnEvent - Created & Emitted when a SceneSpawner successfully spawns (instances) a new game object into the world. It contains information about the spawner and spawned object
Improvements
- Call to inventory add on pickup can now handle partial adds to inventory. When the inventory script returns the count that was added (int or float), then the pickup will subtract the count value from the resource. If the pickup is depleted of remaining item count, then it will be removed from the scene like always.
Bug Fixes
- Fixed an issue where ShapeEdgeSceneSpawner would sometimes not spawn items in all possible directions
Files
Get Item Drops Plugin for Godot 4
Item Drops Plugin for Godot 4
Gatherable Nodes, Pickup Items, Loot Tables, and Spawning Plugin for 2D Godot Games
More posts
- Web Demo is Out!29 days ago
- 0.4.1 Bug Fixes & GdUnit Testing38 days ago
- 0.3 & 0.3.1 Enemy Item Drops & Signal Bus UpdateFeb 25, 2024
Leave a comment
Log in with itch.io to leave a comment.