cgosingtian/Battle-of-Blades — pull request #4 by cgosingtian (2014-09-02 08:01:18+00:00)
Title: Battle of Blades v1.0

Pull request for version 1.
Implemented base game.
GAME LOGIC -----
The objective is to reduce the enemy's health to 0 within the time limit.
Tapping the yellow attack buttons deals damage.
Failing to tap the yellow attack buttons before they disappear causes the enemy to regain health.
For the average difficulty, shields have been added:
Tapping the blue shield button causes the player to lose time.
Failing to tap the blue shield button causes no penalty.
The blue shield button covers the yellow attack buttons below it.
The blue shield button moves around randomly and has a longer lifespan than yellow attack buttons.
For the hard difficulty, movement is enabled for yellow attack buttons as well.

The enemy image changes based on the difficulty.

Starting a battle costs 1 energy.
Upon defeating an enemy, the player gains experience equivalent to the level of the enemy.

Energy is recharged on level up. If energy runs out and battle is attempted, an alert appears that gives the player an option to "pay" for an energy refill.

PROGRAM DESIGN -----
Split the main View Controller (Home View Controller) into three sections:
Header (HomeHeaderView)
Battle (BattleViewController)
Footer (HomeFooterView)
The XIB of the Home View Controller has placeholders for those views so that their layout can be adjusted.
The same idea is done for the Attack Button.
(The button's conversion to Shield type is done programmatically, though).

The implementation of the time limit "count down" is done in the Enemy Controller, because it is an Enemy model data item.
Battle View Controller simply listens for notifications of this timer count down and acts accordingly.
The Attack Buttons inform the Battle View Controller that they were tapped through the AttackDelegate Protocol.