


- Create Variables for “speed”, “direction”, “flag”
- Create a Function to set the Bullet’s Direction, “SetTheDirection(Vector2 direction)”
- Be careful not to be confused with the names of variable “direction”
- to differentiate them, put “this.” in front of “direction”(not the argument)
- normalize the vector to get purely a direction (to make the computing correct and simple)
- set the flag(the boolean variable) as “True” to activate the codes in “Update()” method
- Be careful not to be confused with the names of variable “direction”
- In “Update()” method
- the codes will be activated when the flag is set to “True”
- the position of the bullet is updated every frame by calculating “transform.position” with “direction(Vector2, the result from “SetDirection()”)’
- if a bullet goes out of the screen, Destroy it
- In “Awake()”
- every code in “Awake()” is activated before the game starts
- before the game starts, set “speed” and “ready” with default values




- Add a public GameObject variable to use EnemyBullet prefab as a component
- Create a Function to fire bullets from Enemy, “FireEnemyBullet()”
- get a reference of “Player” by using “GameObject.Find()”
- the way of detecting a GameObject, “if(gameObject != null)”
- if “Player” is detected, a bullet is instantiated and its initial position is set
- how to calculate an aiming direction: Vector – Vector
- to use “SetDirection()” method of “EnemyBullet” Class, use “GetComponent()” towards “bullet”
- In “Start()” method
- make “FireEnemyBullet()” activated after 1 second, by using “Invoke()”


- To apply changes on the prefab, Don’t forget to push “Apply” button in the Inspector
