Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.
Sign up to join this community
Anybody can ask a question
Anybody can answer
The best answers are voted up and rise to the top
I’m looking for some help to someone throw me a light in this problem I’m having.
We’re making a clothing game where you got to grab a “cloth” and a “string” and bringing them to the sewing table to give you one sort of garment.
We’ve already made a list of items but not sure of how to combine them, what you get in return or even how to detect which one is the one you have grabbed.
Thank you in advance.
First you need to detect that there actually are a string and an cloth near the sewing table at the same time. I would do that by adding colliders to all of them and making the collider of the sewing table a trigger.
I would then write a script for the sewing table which uses the OnTriggerEnter and OnTriggerExit event methods to keep track of which items are currently within the trigger area.
When that script detects that both a cloth and a string are present, then I would use the Destroy method to remove both of them and then use the Instantiate method to spawn the garment item as a new game object.