How to Make Video Games 11

How to Make TetrisOnly 2 videos remain until we finish Tetris! In this video we will focus on deleting full rows. We will search each column in each row to find those full of cubes. Then we’ll delete them in the array as well as in the scene. Then we have to bring all blocks above down and then increase the score on the screen.

Like always all the code is available under the video below. Do with it what ever you’d like.

If you like videos like this, consider donating $1 or simply turn off AdBlock. It helps a lot 🙂

Code From the Video

GAMEBOARD.CS

SHAPE.CS

SHAPESPAWNER.CS

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

public class ShapeSpawner : MonoBehaviour {

// Array that holds all the shapes
public GameObject[] shapes;

public void SpawnShape()
{
// Generate a random index
int shapeIndex = Random.Range(0, 6);

// Create the shape at the ShapeSpawners location
Instantiate(shapes[shapeIndex],
transform.position,
Quaternion.identity);
}

// Use this for initialization
void Start () {

// Spawn the default first shape
SpawnShape();
}

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

}
}

Leave a Reply

Your email address will not be published.

Google+