
- by selecting multiple Sprites and adding them in the scene, Create “EnemyAnimation”





- Set the speed of Enemy with a float variable “speed”
- in “Update()” method
- change the position of “enemy” GameObject with “transform.position” every frame
- for memory usage, destroy “enemy” when it goes out of the screen




- Create Empty GameObject and change its name into “EnemySpawner”
- Create “EnemySpawner” Script and add it to “EnemySpawner”

- To use “Enemy Prefab” in the script as a component
- add “Public GameObject” variable
- Don’t forget to add the reference in the inspector
- Create a custom Function, SpawnEnemy()
- Instantiate()
- after instantiating, set the position of Enemy in a random position by using random range of “x” value
- To make it spawn in 5 seconds
- in “Start()”, write “Invoke(string methodName, float time)”
- set the “maxSpawnRateInSeconds” as 5 seconds



- Create a function, “ScheduleNextEnemySpawn()” to spawn multiple times
- by using, “Invoke()” and putting “ScheduleNextEnemySpawn()” inside “SpawnEnemy()”
- without using “loop”, we can make enemy spawned continuously
- by using, “Invoke()” and putting “ScheduleNextEnemySpawn()” inside “SpawnEnemy()”
- To increase the difficulty of the game, Create a function, “IncreaseSpawnRate()”
- in “Start()”
- by using “InvokeRepeating(sting methodName, float time, float repeatRate)”
- every 30 mins, the Spawnrate will be increased(Spawning gets faster)
- In “InvokeRepeating()”, “time” is 0 and “repeatRate” is 30, meaning every 30 secs, “IncreaseSpawnRate()” is invoked
- by using “InvokeRepeating(sting methodName, float time, float repeatRate)”
- in “Start()”
