Hello again all, I'm having problems doing something I though would be simple.
Imagine the character is holding an Item (gun, sword, shield whatever), and they run across a different Item on the ground. The character can only hold one item at a time, so on Key Press the character needs to drop the active Item and pick up the new one. Like this:
(Blue box is the character holding the purple item. When overlapping the green item and pressing a button, character drops the purple item and picks up the green item).
Basically think of the way Master Chief changes weapons in the Halo games. (I eventually want a little box to popup and show you Item Details too, but that is for a later time).
I have each item as a separate Sprite with Pin and Platform Behaviours. The Platform Behaviour has Input set to off, and it is there make the Item drop to the ground when it is Unpinned from the Character. (I have some VectorX/Y set so it does a little arc away from the character).
So far I can make it so the character can pick up an item and then drop it again, but when I try to make it swap Items with what's on the ground, stuff goes haywire.
My thinking on how it should work:
- Character has Item1 Pinned
- Character Overlaps Item2
- Key Pressed
- Item1 -> Unpin (Item1 falls to ground)
- Item2 -> Pins to Character | Position to Image Point
I will eventually have a range of Items, so I'm guessing I'll need to use loops or functions or arrays or something, but I'm quite new to all this, and a lot of that is over my head for now.
Any help would be appreciated and thanks in advance.