I have a few questions concerning making a script where my Player will shoot out missiles that are supposed to go towards the Player’s Enemy’s current location.
A. If I were to use something like Instantiate() in my Player script to clone a missile prefab, I can’t tell the missile where to go exactly because it has no target (the Player has a target, but how would one tell the missile script that??)
OR
B. If I were to make my missiles a child object of the Player (parent)… I could quickly give the missile script the needed information like Player target and its ‘location’ in transform Vector3 coordinates. However, once I shoot off that missile, if I move my Player at all, wouldn’t the missile also move the same way my player is moving since the missile is a child object? How would I make the missile an INDEPENDENT object AFTER it has the information it needed from the Player via script code??
C. Since I am attempting to make a multi-player game, if I originally did an Instantiate() method, all missiles in the gameplay (from any player) would have the exact missile script attached with the exact same Input.KeyDown() commands. If 5 people are shooting missiles and one player presses a key that causes his own missile to explode, would all the missiles in play explode too or just his own missile because his missile is only controlled by his keyboard? How does that kind of situation work??
I need help on which option (A or B) is better… and an explanation of how C works please…