- Home /
Calling a function or Object in a level
I am creating a side scroller game where objects appear through level. My question is how do I make objects of enemies to appear at certain points in the game. For example, I have enemies from Set A and Set B. I want to have enemies set B to appears after all the enemies from set A.
Also, if I moving along the scene or level, I want certain enemies to appear as I move along the scene.
Is there anyway for me to have a function or code to have these object or enemies to appear throughout the scene?
Answer by TonyLi · Jul 17, 2013 at 03:39 PM
You can write a script that instaniates all the enemies from Set A first, and then the enemies from B -- for example, use a variable that keeps track of how many A enemies you've instantiated. When it's above a threshold, instantiate B enemies instead.
Or you can keep track of where the player is using trigger colliders. When the player is in trigger area 1, instantiate A enemies. When the player is in trigger area 2, instantiate B enemies.
Inside trigger area 1, you can have sub-triggers. When the player enters each one of those, you can instantiate an enemy of the appropriate type.
Your answer
Follow this Question
Related Questions
Change Scene after time? 1 Answer
Problem stopwatch start the game. 1 Answer
allowSceneActivation give me error message 0 Answers
Changing background according to local time 0 Answers
Character duplicates herself when re-entering the home level 2 Answers