Game 2: A Small Game Using the Basics

CSC 470 - American University

Description

This exercise is meant to give you the opportunity to creatively apply all of the topics we've covered so far. The goal is to apply every one of the topics we've covered in class into a small game.

Name your Unity project "game02".

In this assignment, create as much of a game as possible that applies all of the topics from class. This will involve conceiving of a small game that is made up of these technical topics. Constraints breed creativity!

In class, be prepared to describe what you are attempting to create by the following week, as well as being able to specifically point out how you applied the technical topics. We will spend the majority of class helping one another understand the remaining topics.

Topics You Must Apply In Your Game

  1. Creating and modfying 3d primitive shapes in the Unity Editor
  2. Creating and applying materials to Game Objects
  3. Changing the background color by editing the Main Camera's clear flag and background color
  4. Applying and configuring Rigidbody Physics components to Game Objects
  5. Creating and applying custom components to Game Objects
  6. Response to player input (Input.GetKeyDown(), Input.GetKey(), Input.GetAxis())
  7. Making use of a game object transform's 'forward' vector
  8. Computing the vector between two objects (and normalizing it)
  9. Scaling a movement vector by Time.deltaTime (through multiplication) in order to ensure smooth continuous movement
  10. Using GameObject.Find() to get references to other game objects in your scene
  11. Directly giving a custom component a reference to another game object by declaring a 'public GameObject' variable in your comonent, and assigning the value to that reference in the Unity Editor (Inspector)
  12. Making use of Random.Range() and Random.value to get random numbers
  13. Creating user interface elements
  14. Buttons: Calling a custom function when a button is clicked (the function needs to be 'public')
  15. Downloading and applying custom fonts to Text objects
  16. Downloading and importing 3D models from Google Poly
  17. Positioning an object's origin by creating empty game objects, and repositioning 'child' objects (this is necessary with many Google Poly models)
  18. Creating and configuring colliders (all game objects need to have a collider in order for Unity to recognize collisions - primitive 3d shapes have these by default, but imported Google Poly models need you to manually apply one)
  19. Creating prefabs
  20. Instantiating and configuring prefabs
  21. Triggers: Making it so the OnTriggerEnter function is called when two objects collide (both objects need colliders, at least on of the colliders must be marked as a "Trigger", and at least one of the objects needs to have a RigidBody component - you will often want to remove gravity and mark it as kinematic)
  22. The timer pattern: Create a float variable with a value of the time you want to count down from. Decrease that variable by Time.deltaTime in your Update function. When that variable is less than zero, perform the action you want to have happen, and reset the countdown variable.

Mike's Example

Think small! Here's an example project that mostly satisfies the constraints of the assignment.

CODE PLAY

Building your Project for the Web

Submission

Submit your project to github. Make sure your Unity project is titled "game02" and located in the "exercises" folder of your local github repository. To push it up to github, open Github Desktop, commit your changes (you need to enter a comment in the field on the bottom left of the screen), and click the "Push origin" button near the top middle of the screen.

If everything worked, you should be able to play your game by going to:

http://(your git username).github.io/csc470-fall2020/exercises/game02/web