How to Make Video Games 9

How to Make TetrisIn this video I continue creating Tetris! This time I cover how to Move and Rotate Shapes, Except Keyboard Input, Spawn Shapes, Handle Custom Collisions, Debug, Make Shapes Fall, and Move Objects at Different Time Frames.

Like before I create all the code here blind with no previous preparation. All the code follows the video below.

If you like videos like this consider donating $1 on Patreon, or simply turn off AdBlock. Either helps a lot.

Code From the Video

Shape.cs

ShapeSpawner.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ShapeSpawner : MonoBehaviour {

public GameObject[] shapes;

public void SpawnShape()
{
int shapeIndex = Random.Range(0, 6);

Instantiate(shapes[shapeIndex],
transform.position,
Quaternion.identity);
}

// Use this for initialization
void Start () {
SpawnShape();
}

// Update is called once per frame
void Update () {

}
}

Leave a Reply

Your email address will not be published.

Google+