Arvutiteaduse instituut
  1. Kursused
  2. 2022/23 sügis
  3. Arvutimängude loomine ja disain (MTAT.03.263)
EN
Logi sisse

Arvutimängude loomine ja disain 2022/23 sügis

  • Main
  • Lectures
    • Homework-1
    • Homework-2
    • Homework-3
  • Labs
    • Lab1 Introduction to Unity
    • Lab2 Space Game part 1
    • Lab3 Space Game part 2
    • Lab4 Unity Components
    • Lab5 Project Setup
    • Lab6 Tower Defence
    • Lab7 Tower Defence GUI & Buildings
    • Lab8 Tower Defence Content
    • Lab9 Blender Tree
    • Lab10 Sounds
    • Lab11 Animations
    • Lab12 Level Design
    • Lab13 Editor Extensions
    • Lab14 Lighting
    • Lab15 Procedural Generation
  • Projects
    • Design Document
    • Peer Review
  • Links

Lab 2 & 3 - Introduction to Unity

Watch the lab Video
This task consists of 2 lab sessions - we will start today and continue next week. The deadline is before the beginning of lab 4 (you don't have to submit anything in between).

Implement a shoot them up (shmup) style space game. Your game should look similar to the following picture:

Last year games (part1 + part2): https://youtu.be/UhLd6izH04E

Steps:

  1. Download graphics files: https://opengameart.org/content/space-shooter-redux
  2. Download background shader: https://optimatica.eu/courses/shmup/background_shader.zip
  3. Create a new Unity 2D project
  4. Make infinitely scrolling background:
    1. Add graphics and background.shader to your project.
    2. 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”.
    3. 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.
    4. Make the camera move continuously upwards
  5. Add player spaceship:
    1. Add a spaceship sprite to your scene. Attach a new SpaceShip script to it.
    2. Make your ship to follow your mouse cursor. Hint: Camera.main.ScreenToWorldPoint(mousePosition);
    3. Bound the ship inside the visible play area. Hint: https://answers.unity.com/questions/501893/calculating-2d-camera-bounds.html
    4. Add a 2D collider to your ship
    5. Extra: make your ship tilting left or right depending on the direction you are moving.
  6. Make spaceship shoot automatically:
    1. Create a new bullet prefab with the appropriate sprite and collider.
    2. Make the bullet move forward.
    3. Destroy the bullet when it leaves the view.
    4. Make the player ship to spawn bullets every fixed amount of time.
  7. Add enemy ships:
    1. Create enemy ship prefab, with sprite, collider, and script.
    2. Add health parameter to it, destroy it when health reaches 0.
    3. Do damage to enemy ships when they collide with your bullets.
    4. Add lives parameter to the player ship, restart the game when it reaches 0.
    5. When the player collides with an enemy remove one life and destroy the enemy ship.
    6. Add linear movement vector to the enemy ship which configures its movement speed and direction. Trigger enemy movement when it becomes visible.
    7. Make enemy ships rotate towards their moving direction
    8. Add multiple enemy ships to your scene and test it.
  8. Add UI:
    1. Create a new UI Canvas with a canvas scaler that scales your UI proportionally to the screen size.
    2. Add a score text with a custom font (you can find one under the Bonus folder).
    3. Add an energy bar that consists of foreground and background images. The foreground image should have an image type "filled" property.
    4. Add a panel with small ship images representing remaining lives.
    5. Add horizontal layout group to the panel to align images automatically.
    6. 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.
    7. Assign the UI script to a static variable so you can access it from everywhere.
  9. Add lives and score:
    1. When your player loses a life, remove it from UI as well.
    2. Make your player invincible for a few seconds after losing a life.
    3. Reduce the opacity of the player ship while it is invincible.
    4. Every time you destroy an enemy ship, increase your score.

Submission

This time you don't submit anything. We will continue during the next lab and then you will submit it once.

NB! Make sure that you have all these steps done before the next lab begins!

  • Arvutiteaduse instituut
  • Loodus- ja täppisteaduste valdkond
  • Tartu Ülikool
Tehniliste probleemide või küsimuste korral kirjuta:

Kursuse sisu ja korralduslike küsimustega pöörduge kursuse korraldajate poole.
Õppematerjalide varalised autoriõigused kuuluvad Tartu Ülikoolile. Õppematerjalide kasutamine on lubatud autoriõiguse seaduses ettenähtud teose vaba kasutamise eesmärkidel ja tingimustel. Õppematerjalide kasutamisel on kasutaja kohustatud viitama õppematerjalide autorile.
Õppematerjalide kasutamine muudel eesmärkidel on lubatud ainult Tartu Ülikooli eelneval kirjalikul nõusolekul.
Courses’i keskkonna kasutustingimused