Class

Battle

Battle() → {Battle}

Constructor

# new Battle() → {Battle}

The builtin turn-based battle system.

View Source battle.js, line 12

Battle

Methods

# show(config, callback) → {undefined}

Shows the default turn-based battle system based the supplied config. Currently battles ranging from 1v1 to 4v4 are supported, the same enemy or character can be used multiple times.
Parameters:
Name Type Description
config Object
callback Callback

View Source battle.js, line 44

undefined
Example
let config = {
 enemies: ["evil-eye.enemy", "evil-eye.enemy", "evil-eye.enemy" "evil-eye.enemy"],
 characters: ["Hero.character", "Hero.character", "Hero.character", "Hero.character"],
 backgroundImage: "battle-background.png",
 battleMusic: "Battle.ogg",
 itemSoundEffect: "item.ogg"
}
battle.show(config, function(result) {
 rpgcode.log("The battle has ended! result.status=" + result.status);
 rpgcode.endProgram();   
});