help please, scripting, prefabs
Hello,
Currently, I have 2 player prefabs(a blue and a red), each with their own bullet attached. They can move left and right. One player is on the screen at a time. The blue player can only shoot blue targets and red player can only shoot red targets.
However, I would like the blue player to turn, after shooting 3 of its targets, into the red player and vice versa...
I tried an enable/disable script. This is a problem, because 1.) it was triggered on the space key and 2.) the player would not switch from blue to red in the same position. The red would simply appear where I had placed it on the screen in the beginning, instead of "following" the blue player or looking like the blue player turned into the red player.
Please help, Ive been searching for a long time on how to do this. Maybe Im just bad with the terminology, because Im new. Thank you.
Answer by Larry-Dietz · Dec 05, 2017 at 07:32 AM
Change your trigger make when switch after 3 targets have been hit, then in the code that runs on the third target hit do something like this ... PSUEDO CODE ...
RedPrefab.transform.position = BluePrefab.transform.position;
RedPrefab.SetActive(true);
BluePrefab.SetActive(false);
hope this helps, -Larry
Your answer
Follow this Question
Related Questions
Adding prefab objects to a list on another script and object? 2 Answers
Score system using prefabs in C# 0 Answers
how to detect when a sprite is on a prefab/object? 0 Answers
How can i incorporate mini games in my open world game? 0 Answers
How to enable and disable back game object for ui button after a few seconds? 1 Answer