What I want is for my character to pick up an item. No inventory just the item to be held by the character
I have three ideas on how to do it:
- Code: Select all
Collision -> Script Editor -> button press -> Pick up item
The problem is I when I use getKeyState, I can long press the button and it will equip/throw the item. The solution I think is to simulate a keydown event in script editor without repetition.
- Code: Select all
Key Down -> Script Editor -> Collision -> Pick up item
The problem here is I can't see any collision function that will check if two objects collide.
- Code: Select all
Global Code -> bool colliding
Collision -> Script Editor -> colliding = true
Key Down -> Script Editor -> if(colliding) -> Pick up item
I have more problems with this one: I don't like having many global vars, How would I know what item I'm colliding with.
I need help how to pick up an item, and if you ask me I like the first one the best since it's the first thing that came to my mind. I am actually using it, but the long press problem is really an issue. And for the second one, I think it can be solved by a global var bool collider which I really don't like.
Thank you for reading this long post of mine.