Game Development Reference
In-Depth Information
and its strength is determined by the current power status of the player. The other options are one potion, which is
taken to replenish hit points, and three magic attacks. These items are not free and must be purchased between levels
by using the coins earned when winning battles.
A battle will continue until all enemies are defeated in the level. When a level is complete, the player is rewarded
with an increase in power, defense, max hit point count, and coins. These values are declared in the level data. These
results will be displayed on a new screen, which will also include a magic shop where the player can purchase items to
be used in future battles.
After winning a level, the next concurrent level is then unlocked and ready to play. Each level will increase
in difficulty by introducing new, more powerful enemies into the battle. Each level won will reward higher stats,
respectively. There are a total of eight field battles and one boss fight. It is very likely that a player will have to repeat
levels to gain higher stats before defeating higher levels.
The game data in this type of game will always need to be tested and adjusted accordingly to properly run a
successful RPG battle system that is both fun and fair. In the case of this project, the data has been loosely prepared,
so it may or may not suit your standards for a well-balanced game. The point of this project is to recognize the data
patterns and to see where these values can be adjusted to alter the flow of the game.
With a good understanding of what you will be building, the Game class will now be reviewed in detail, starting
with its properties. There is a lot to cover, so let's get started.
Starting the Game Class and its Properties
As in most game scenes, the Game class will be a container that will hold all logic needed to run the level. Listing 14-21
shows the signature and properties for the Game class.
Listing 14-21. Game.js - The Game Class Properties
(function () {
window.game = window.game || {}
function Game(levelData, startTime) {
this.levelData = levelData;
this.lastEnemyAttack = startTime;
this.initialize();
}
var p = Game.prototype = new createjs.Container();
p.Container_initialize = p.initialize;
p.ENEMY_ATTACK_DURATION = 2500;
p.battlePanel = null;
p.enemyHolder = null;
p.levelData = null;
p.hero = null;
p.enemies = null;
p.lastEnemyAttack = null;
p.enemiesAreAttacking = null;
 
Search WWH ::




Custom Search