Skip to content

heyx3/BlockBreaker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

BlockBreaker

A simple Unity game designed for iOS. The player(s) clear groups of identical blocks; bigger groups give exponentially more points.

Game Modes

There are two game modes:

  • Timed
    • One player tries to get as high a score as possible in the allotted time
  • Turn-based
    • Two players take turns clearing blocks. The player with the highest score after a certain number of turns is the winner.

Code

Game Grid

The blocks are organized on a rectangular grid of a fixed size. Grid-related scripts are stored in "Assets/Scripts/Game Grid Stuff".

The grid representation is stored in the "GameGrid" MonoBehaviour script; it holds a 2D array of integers (representing the different types of blocks) and provides methods for modifying the grid.

The block objects each have a "GameGridBlock" MonoBehaviour component, which constantly seeks toward its position in the grid. The blocks are given animation by simply moving them away from their grid position, making them move back towards it again (this is most easily accomplished through the use of the "PushBlockAway" Monobehaviour script).

The blocks are generated by the "GameGridGenerator" MonoBehaviour script on its "Start()" method.

Player Input

Player input is handled by the script "Assets/Scripts/PlayerInput.cs". It waits for a finger tap (or mouse click if testing in the editor) and checks whether the tap was on a block, in which case it clears the block and any blocks that touch it.

Gameplay Flow

All game flow scipts are in "Assets/Scripts/Gameplay Controllers". "GameplayController.cs" is an abstract MonoBehaviour class that represents some game mode. There are two classes that inherit from it: "GameplayController_Timed" and "GameplayController_TurnBased".

Both of these game modes have their own gameplay scene, as well as an accompanying "Review" scene that shows the scores once the game is over.

UI

All UI scripts are in "Assets/Scripts/UI". They use the old UI system for Unity (using the "GUI" class).

License

This game is released under the MIT License:

The MIT License (MIT)

Copyright (c) 2015 William Manning

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

About

Test mobile game.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages