- Home /
Multiple questions/discussion question
Destroy Clones One At A Time Javascript
Currently in my game that I'm creating, I have an "Air Bubble" idea where the player will be losing "air" as the game progresses. I have this displayed on the screen in the picture below. The bubbles that are being Instantiated are clones of a main game object. How can I destroy these one at a time in order to simulate losing "air?" I currently have a "playerLife" script that repeats every 10 seconds and drops the player's life by 1. That's how I intend to implement it, but I want to be able to attach the playerLife to the clones of the air bubbles. Would I have to do this separately? Also, you'll notice that there is an object on the screen that says "Air." When the player collects that, I want ONE instance of the Air Bubble clones to be re-instantiated...how can I do this? I know I'm asking a lot of questions at once and if you want to tackle them one at a time, feel free. Thanks in advance for the help!!
Unity Answers is designed for a single, specific technical question. You have multiple questions here. In addition your core question...the display of the bubble indicators, has a multiple of possible solutions...some simple, come complex, and all with some trade-offs. I'm not sure what path to point you to, but I encourage you to think about hiding and showing your indicator bubbles rather than creating and destroying them. Also consider a single object that hides or show a specific part of a strip of bubbles rather than individual game objects. This can be done in GUI or in a world object, and looking at UA posts on health indicators should give you some ideas.
As things stand now, this is really a discussion question. We ask that discussion questions be posted to Unity Formus. As you break this down to individual issues, we welcome your specific technical problems.