Pick up items from the ground
Opened this issue · 0 comments
The player should be able to pick up items laying on the ground. This usually goes as follows:
- Take a nearby item into focus
- Play an animation depending on where that item is
- During that animation, remove the item from the world
- Place the item into the inventory
- Return to normal idle state
As a starting point, check out the CharacterEventQueue
component, which handles gameplay-related things. The event you'd have to implement is ManipulateMessage::ST_TakeObject
.
Getting the item in focus
Until #66 is not done, we don't have any "focusing" (Edit: Focusing was implemented in #92, just not as fast). However, that doesn't put this issue on hold. Just use GameWorld::findItemsInRange()
with a short range and take anything from that.
Playing the animations
The CharacterAI
-Component should be extended with a method to play the pickup animation. I'm not sure whether the pickup animation uses animation-events to trigger the actual pickup, or whether the original just uses "when the animation is at 50% done" or something.
Remove the item from the world
Removing stuff from the world is not possible right now and thus needs to be implemented. I think we should let the GameWorld
handle that for us, so a GameWorld::removeItem(HItem item)
method should take care of that.
Place the item into the inventory
We've got an Inventory
component inside #60, which should be merged soon.
Return to normal idle state
Returning to the normal idle state should be taken care of by the animation system, nothing to do here!