UNITY | PROJECT | SPACE SHOOTER 2D | 6. Explosion​ Animation

2
Explosion Sprite | Sprite Editor

 

4
Explosion Sprite | Sprite Editor | Slice

 

5
Explosion Sprite | Inspector
  • For the Sprite of Explosion in the Inspector
    • Set the Sprite Mode into “Multiple”
    • Set the Filter Mode into “Point(no filter)”
    • Set the Max Sie into “1024”
6
Creating Animation from Sprite

 

7
“ExplosionAnimationContoller”
8
“Explosion” GameObject

 

9.1
Deselect “Loop Time”

 

9.2
“Explosion” Animation
  • “Explosion” Animation is appearing continuously

 

 

9.3
“Explosion” Animation

 

  • “Explosion” Animation works well except that the last frame of the animation lasts in the scene

 

10
Creating & Adding “Destroyer” Script

 

11
“Destroyer” Script
12
“Animation” Tap
13
Adding an Animation Event to “Explosion” Animation

 

14.1
Adding an Animation Event to “Explosion” Animation
14.2
“Explosion” Animation
15
Creating “Explosion” Prefab

UNITY | PROJECT | SPACE SHOOTER 2D | 4. Enemy Animation & Enemy Spawner

2
Creating Enemy Animation
  • by selecting multiple Sprites and adding them in the scene, Create “EnemyAnimation”

 

3
Changing the name of EnemyAnimationController

 

4.1
“Enemy” GameObject

 

4.2
“Enemy” GameObject with Animation

 

5
Adding “EnemyControl” Script to “Enemy” GameObject

 

6.1
“EnemyControl” Script
  • 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

 

6.2
“Enemy” Moving

 

6.3
“Enemy” Destroyed when outside of the screen

 

7
Creating “Enemy” Prefab

 

8
Creating “EnemySpawner” & Adding “EnemySpawner” Script
  • Create Empty GameObject and change its name into “EnemySpawner”
  • Create “EnemySpawner” Script and add it to “EnemySpawner”

 

9.1
“EnemySpawner” Script
  • 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

 

9.2
Enemy Spawning

 

10
Don’t forget to add the reference

 

11.1
“EnemySpawner” Script
  • 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
  • To increase the difficulty of the game, Create a function, “IncreaseSpawnRate()”

 

11.2
Spawning Enemies

UNITY | PROJECT | SPACE SHOOTER 2D | 1. CREATING PROJECT & PLAYER ANIMATION

SPACE SHOOTER 2D

1. CREATING PROJECT & PLAYER ANIMATION

2
Creating Project & Folders
  • creating the Project
  • creating Folders for each component
    • Scenes
    • Scripts
    • Prefabs
    • Sprites
    • Sound
    • Animations
3
Camera & BackGround
  • Changing BackGround Color
  • Changing Camera Size

 

4
Player Sprite | Sprite Editor
  • Adding “Player” Sprite to “Sprites” folder
  • Changing “Texture Type” to “Sprite(2D and UI)”
  • “Sprite Editor”

 

6
Sprite Editor
  • In “Sprite Editor”
    • changing Type to “Grid By Cell Type”
    • Pixel Size into X:72 / Y : 72
    • Press “Slice”

 

8
Sliced Sprite | Sprite Setting
  • “SpaceShip.png” has been sliced into 12 pieces
  • in the Inspector
    • deselect “Generate Mip Maps”
    • change “Filter mode” into “Point(no filter)”
    • change “Max Size” into 1024

 

9
Selecting multiple Sprites to create “Player” object
  • Trying to create “Player” object with animation by selecting multiple Sprites

 

10
Creating “Player” object with multiple Sprites
  • Saving “PlayerAnimation” in “Animation” folder
11
“Player” object with Animation
  • an “AnimationController” has been created automatically for “PlayerAnimation”

 

12
“PlayerAnimation”
13
Changing “Player” to “PlayerGo”

 

ezgif.com-video-to-gif
“PlayerGo” with animation