- Think of a variable like an envelope it holds anything you put inside of it.
- Int - Stores integers (whole number negative and positive).
- public int year = 365;
- Boolean - Stores true or false values.
- public bool hired = true;
- Float - Stores decimal numbers.
- public float speed = .5f;
- Parents and Youth Orientation
- Check-ins and Ice breakers
- Introduction to Game Development and Unity
- Editor tour
- Basic navigation (e.g. Scene, Game, Directional Light, Console, Project, Asset Store, Inspector),
- Game objects/Components (e.g. RigidBody, Collider, Transform, Mesh Renderer)
- Building simple game from 3D primitives
- Created objects Cube, players
- Created a C# Script (CubeMove) for moving the cube in four directions
- Created Microsoft OneDrive Accounts to save projects
using UnityEngine;
using System.Collections;
public class CubeMove : MonoBehaviour {
public float speed = .5f;
// Use this for initialization
void Start () {
}
//Update is called once per frame
void Update () {
if(Input.GetKey(KeyCode.W)){
transform.position += new Vector3 (0, 0, speed);
}
if(Input.GetKey(KeyCode.S)){
transform.position += new Vector3 (0, 0, -speed);
}
if(Input.GetKey(KeyCode.A)){
transform.position += new Vector3 (-speed, 0, 0);
}
if(Input.GetKey(KeyCode.D)){
transform.position += new Vector3 (speed, 0, 0);
}
}
}
-
Introductions to Standard assets (e.g. Materials, Scripts)
-
Basic scripting * Collision detection for picking up objects * Created a game manager * Free building and game designing
-
Created new cubes (naming them Danger Zones, Enemies) * Stretched them into rectangles (Transform Components) * Added color to objects * Adding various components to the objects like Rigidbody, Colliders, and collision
-
Introduction to Blender
-
Created C# Scripts * Enemy-collects objects when the player collides with object *Danger Zone- the player dies when it triggers the danger zone (Red Area)
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Enemy : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter(Collider obj){
CubeMove.lives -= 1;
Destroy (obj.gameObject);
Application.LoadLevel(0);
}
}
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class DangerZone : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter(Collider obj){
if (obj.tag == "player") {
Destroy (obj.gameObject);
}
}
}
- Introduction to the Blender and the Terrain tool
- Used various images from Google Images for game design
- Created objects (ship, Iceberg terrain) and installed them into Unity
- Created landscape and added CubeMove script to ship
- https://twitter.com/albertolacon/status/739535527339163648
- Introduction
- Check-ins
- Ice breakers
- Introduction to Unity and Blender
- Presentations of few games by the instructor
- Creating account for Unity
- Check-ins
- Downloading Unity and Blender
- Start to work on first project in unity
- Create two objects( Enemy, Player)
- Adding Rigidbody 2D (Physics to the object)
- Adding box Collider 2D (Physics to the object)
- Create C# scripts
- CubeMove--moves the object player in four directions upon pressing down certain keys
- Enemy (which was DangerZone in the Microsoft Workshop)
- WinZone (which was Enemy in the Microsoft Workshop)
using UnityEngine;
using System.Collections;
public class CubeMove : MonoBehaviour {
public float speed = .5f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetKey(KeyCode.W)){
transform.position += new Vector3 (0, 0, speed);
}
if(Input.GetKey(KeyCode.S)){
transform.position += new Vector3 (0, 0, -speed);
}
if(Input.GetKey(KeyCode.A)){
transform.position += new Vector3 (-speed, 0, 0);
}
if(Input.GetKey(KeyCode.D)){
transform.position += new Vector3 (speed, 0, 0);
}
}
}
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Enemy : MonoBehaviour {
public Text text;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (CubeMove.lives == 0) {
text.enabled = true;
}
}
void OnTriggerEnter(Collider obj){
CubeMove.lives -= 1;
Destroy (obj.gameObject);
Application.LoadLevel(0);
}
}
#WinZone C# script
using UnityEngine;
using System.Collections;
public class WinZone : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter(Collider obj){
Destroy (obj.gameObject);
}
}
- Review from last week
- Update CubeMove and Enemy scripts by adding variables speed and lives
- Application.LoadLevel--reloading the game/level
- Learning to use Build Settings
- Learning to use Unity API
- Tagging the cube--“player”
- Adding Canvas and text to game
- Adding color to object/Creating Materials/Assets folder
using UnityEngine;
using System.Collections;
public class CubeMove : MonoBehaviour {
public float speed = .5f;
public static int lives=3;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetKey(KeyCode.W)){
transform.position += new Vector3 (0, 0, speed);
}
if(Input.GetKey(KeyCode.S)){
transform.position += new Vector3 (0, 0, -speed);
}
if(Input.GetKey(KeyCode.A)){
transform.position += new Vector3 (-speed, 0, 0);
}
if(Input.GetKey(KeyCode.D)){
transform.position += new Vector3 (speed, 0, 0);
}
}
}
(Using the variable Speed it’s able to change the speed of the controls. Lives is also created to keep track of how many lives are in the game at that moment.)
using UnityEngine;
using System.Collections;
public class CubeMove : MonoBehavior {
public float speed = .5f;
public static int lives=3;
// Use this for initialization
void Start (){
}
(The 5th line tells it to subtract one from the variable lives when the player collides with the enemy)
void Update () {
}
void OnTriggerEnter(Collider obj){
Destroy (obj.gameObject);
Application.LoadLevel("Game");
}
}
(This belongs on the Enemy script and makes it reset the level when you touch (collide) the player object with the enemy object.)
#Week 4: July 2
- Reviewing CubeMove, Enemy, and WinZone scripts
- Making the text “Game Over!” appear when the lives count reached 0.
- Adding images to objects
- Creating a pick-up system (using the Enemy script) with coins and other collectables
- Understanding how to read the Console and fix errors in code
- Rotating the object 45 degrees when it touched the wall
- Using Blender 3D Model Repository to upload 3D Models into Unity
- Parenting the 3D Model to the AI cube into order to place the 3D model on top of the cube
- Using Mesh Renderer to make the cube invisible and make only the 3D model visible
- Creating background using Google Images (e.g. sand and water)
- Creating an object that chases the original object
using UnityEngine;
using System.Collections;
public class AIController : MonoBehaviour {
public float speed = 2.0f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.Translate (Vector3.forward * Time.deltaTime * speed);
}
}
using UnityEngine;
using System.Collections;
public class WallController : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter(Collider obj) {
if (obj.tag == "AI") {
transform.Rotate (new Vector3 (0, 180, 0));
transform.Rotate (new Vector3 (0, 45, 0));
}
}
}
- Based on a set of rules: the students completed a game that was required to have: * An AI controller object that moved on its own * CubeMove, Enemy, WinZone Scripts * A rotation once the object touched the wall * An object that chased the other object * A 3D model parented to the AI Controller * An object that the player can control (with the keys--W, A, S, D) * Preface to publishing game on Itch.io