Lab 3 & 4 - Introduction to Unity
This lab consists of 2 practice sessions. You have to submit this task only once so you have 2 weeks in total to do this task. But it is recommended to complete at least first 9 steps before the beginning of lab 4. The deadline for this task is before the beginning of lab 5.
Implement a shoot them up (shmup) style space game.
Your game should look similar to the following picture:
Steps:
- Download graphics files: https://opengameart.org/content/space-shooter-redux
- Download background shader: https://optimatica.eu/courses/shmup/background_shader.zip
- Create a new Unity 2D project
- Make infinitely scrolling background:
- Add graphics and background.shader to your project.
- Create a new background material using background.shader (Shader->Custom->Background), add a suitable background texture to it, change the textures’ wrap mode to “Repeat”.
- Add a 3D quad to your scene, add background material to it, scale it up, move it further on the z-axis and attach it to your camera.
- Make the camera move continuously upwards
- Add player spaceship:
- Add a spaceship sprite to your scene. Attach a new SpaceShip script to it.
- Make your ship to follow your mouse cursor.
- Bound the ship inside the visible play area. Hint: https://answers.unity.com/questions/501893/calculating-2d-camera-bounds.html
- Add a 2D collider to your ship
- Extra: make your ship tilting left or right depending on the direction you are moving.
- Make spaceship shoot automatically:
- Create a new bullet prefab with appropriate sprite and collider.
- Make the bullet move forward.
- Destroy the bullet when it leaves the view.
- Make the player ship to spawn bullets every fixed amount of time.
- Add enemy ships:
- Create enemy ship prefab, with sprite, collider, and script.
- Add health parameter to it, destroy it when health reaches 0.
- Do damage to enemy ships when they collide with your bullets.
- Add lives parameter to the player ship, restart the game when it reaches 0.
- When the player collides with an enemy remove one life and destroy the enemy ship.
- Add linear movement vector to enemy ships. Move it to that direction when it is close to the camera.
- Make enemy ships rotate towards their moving direction
- Add multiple enemy ships to your scene and test it.
- Add UI:
- Create a new UI Canvas with canvas scaler that scales your UI proportionally to the screen size.
- Add a score text with a custom font (you can find one under the Bonus folder).
- Add an energy bar that consists of foreground and background images. The foreground image should have an image type "filled" property.
- Add a panel with small ship images representing remaining lives.
- Add horizontal layout group to the panel to align images automatically.
- Add a UI script to your canvas that gets references to all the necessary UI elements and provides public methods to change score, energy and remaining lives.
- Assign the UI script to a static variable so you can access it from everywhere.
- Add lives and score:
- When your player loses a life, remove it from UI as well.
- Make your player invincible for a few seconds after losing a life.
- Reduce the opacity of the player ship while it is invincible.
- Every time you destroy an enemy ship, increase your score.
- Add win and lose conditions:
- When you lose all your lives, show a “You Lost” text on UI for a few seconds before restarting.
- When you reach far enough in your level, show a “You Won” text on UI for a few seconds before restarting.
- Under both of these texts show a smaller text with your score, eg: “Your score: 999”
- Add a darker background behind win and lose texts.
- Add shield skill:
- Make your right mouse button to spawn a shield around your ship that prevents taking damage.
- Holding the button down should reduce your energy.
- Do not spawn the shield while energy is depleted.
- Recharge the energy slowly when the skill is not active.
- Add particle effects:
- Make enemies and your own ship to spawn particles when destroyed.
- Extra: add thruster particles behind your ship.
- Add more types of enemies (at least 3 in total), they have to implement the following features:
- Make some enemies shooting their own projectiles towards you.
- Make some enemies with more complex moving patterns, you can either use a math function like a sine wave, animation curve or even a custom animation.
- Add laser beam skill:
- Make your left mouse button fire a laser beam.
- The laser beam is a line that travels instantly from your ship to the top of the screen. It should not go any further.
- Laser beam damages all the enemies in between.
- Laser beam also spends energy similar to the shield skill.
- Add powerups:
- Add at least two types of powerup pellets that can be consumed by touching with your spaceship.
- Some ideas about what a powerup can do:
- Increases your rate of fire permanently
- Adds an extra health
- Replenishes energy
- Shoots a radial wave of bullets out of your spaceship
- Add levels:
- Make a copy of your scene and create a more difficult level in it.
- After you win a game switch to the second level instead of restarting.
- Make the first level about 1 minute long and not very hard to beat on the first try.
- Your first level should have at least 3 types of enemies and 2 types of powerup pellets.
- Build your game and test it.
Submission
Submit a compiled version of your game (Windows 64 build). Zip your build folder into a single package and make sure that all the additional files (that were created when building the game) are also included in this package. Don't submit your source code.
6. Lab 3 & 4 - Space GameSellele ülesandele ei saa enam lahendusi esitada.