Added battle fight menu

Doesn't do anything except read in from from moves and show that list.
This commit is contained in:
Josh Goldberg
2015-02-19 15:15:39 -05:00
parent 2d36e224f7
commit 4d28d2fbfd
4 changed files with 75 additions and 41 deletions
+52 -28
View File
@@ -5,7 +5,14 @@ FSP.BattleMover.startBattle({
},
"playerActors": [
{
"title": "Mew"
"title": "Squirtle",
"moves": [{
"title": "TACKLE"
}, {
"title": "TAIL WHIP"
}, {
"title": "BUBBLE"
}]
}
]
});
@@ -31,7 +38,7 @@ function BattleMovr(settings) {
battleMenuName,
battleMenuOptions,
battleOptionNames,
battleInfo,
@@ -57,9 +64,9 @@ function BattleMovr(settings) {
throw new Error("No battleMenuName given to BattleMovr.");
}
battleMenuOptions = settings.battleMenuOptions;
if (typeof battleMenuOptions === "undefined") {
throw new Error("No battleMenuOptions given to BattleMovr.");
battleOptionNames = settings.battleOptionNames;
if (typeof battleOptionNames === "undefined") {
throw new Error("No battleOptionNames given to BattleMovr.");
}
animations = settings.animations;
@@ -176,33 +183,20 @@ function BattleMovr(settings) {
function showPlayerMenu() {
EightBitter.MenuGrapher.createMenu("BattleOptions");
EightBitter.MenuGrapher.addMenuList("BattleOptions", {
"options": battleMenuOptions
"options": [{
"text": battleOptionNames["moves"],
"callback": self.openMovesMenu
}, {
"text": battleOptionNames["items"]
}, {
"text": battleOptionNames["actors"]
}, {
"text": battleOptionNames["exit"]
}]
});
EightBitter.MenuGrapher.setActiveMenu("BattleOptions");
}
///**
// *
// */
//self.showBattleMenu = function () {
// EightBitter.MenuGrapher.createMenu("GeneralText");
// EightBitter.MenuGrapher.createMenu("BattleDisplayOpponent");
// EightBitter.MenuGrapher.addMenuDialog(
// "BattleDisplayOpponent",
// actors.opponent.displayTitle
// );
// EightBitter.MenuGrapher.createMenu("BattleOptions");
// EightBitter.MenuGrapher.addMenuList("BattleOptions", {
// "options": battleMenuOptions
// });
// EightBitter.MenuGrapher.setActiveMenu("BattleOptions");
// // Used by MenuGrapher.addMenuDialog
// return false;
//};
/**
*
*/
@@ -230,6 +224,36 @@ function BattleMovr(settings) {
);
};
/**
*
*/
self.openMovesMenu = function () {
var actorMoves = battleInfo.playerActors[0].moves,
moveOptions = [],
move, i;
for (i = 0; i < actorMoves.length; i += 1) {
move = actorMoves[i];
moveOptions[i] = {
"text": move.title,
"remaining": move.remaining,
"callback": console.log.bind(console, "Hi!")
};
}
for (i = actorMoves.length; i < 4; i += 1) {
moveOptions[i] = {
"text": "-"
};
}
EightBitter.MenuGrapher.createMenu("BattleFightList");
EightBitter.MenuGrapher.addMenuList("BattleFightList", {
"options": moveOptions
});
EightBitter.MenuGrapher.setActiveMenu("BattleFightList");
};
self.reset(settings || {});
}
+1 -1
View File
@@ -543,7 +543,7 @@ function MenuGraphr(settings) {
top = menu.top + menu.textYOffset * EightBitter.unitsize,
textProperties = EightBitter.ObjectMaker.getPropertiesOf("Text"),
textWidth = (menu.textWidth || textProperties.width) * EightBitter.unitsize,
textHeight = (menu.textWidth || textProperties.height) * EightBitter.unitsize,
textHeight = (menu.textHeight || textProperties.height) * EightBitter.unitsize,
textPaddingY = (menu.textPaddingY || textProperties.paddingY) * EightBitter.unitsize,
arrowXOffset = (menu.arrowXOffset || 0) * EightBitter.unitsize,
arrowYOffset = (menu.arrowYOffset || 0) * EightBitter.unitsize,
+6 -11
View File
@@ -1,16 +1,11 @@
FullScreenPokemon.prototype.settings.battles = {
"battleMenuName": "Battle",
"battleMenuOptions": [
{
"text": "FIGHT",
}, {
"text": "ITEM",
}, {
"text": ["Poke", "Mon"]
}, {
"text": "RUN",
}
],
"battleOptionNames": {
"moves": "FIGHT",
"items": "ITEM",
"actors": ["Poke", "Mon"],
"exit": "RUN"
},
"defaults": {
"textStart": ["A wild ", " appeared!"],
"textEntry": ["Go! ", "!"]
+16 -1
View File
@@ -656,6 +656,21 @@ FullScreenPokemon.prototype.settings.menus = {
"textSpeed": 0,
"textXOffset": 1,
"textYOffset": -.5
}
},
"BattleFightList": {
"size": {
"width": 64,
},
"position": {
"horizontal": "right",
"vertical": "stretch"
},
"container": "GeneralText",
"backMenu": "BattleOptions",
"textXOffset": 8,
"textYOffset": 3.5,
"textPaddingY": 4,
"arrowXOffset": 1
},
}
};