From 7b7d325595bdc2835c2bb556a334808fdefc864b Mon Sep 17 00:00:00 2001 From: Florrie Date: Sun, 12 Aug 2018 11:27:30 -0300 Subject: Teams of three --- index.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index a39f314..e312d32 100644 --- a/index.js +++ b/index.js @@ -522,6 +522,8 @@ class Team { constructor({battle}) { this.battle = battle this.characters = [ + new BattleCharacter({team: this, battle}), + new BattleCharacter({team: this, battle}), new BattleCharacter({team: this, battle}) ] } @@ -556,10 +558,23 @@ class Camera extends Sprite { const battle = new Battle() -Object.assign(battle.teams[0].characters[0], {x: 0, y: 240, name: 'Ren'}) -Object.assign(battle.teams[1].characters[0], {x: 0, y: 200, name: 'Phooey'}) - -// battleCharacter.targetCharacter = enemyCharacter +for (let ti = 0; ti < battle.teams.length; ti++) { + const team = battle.teams[ti] + for (let ci = 0; ci < team.characters.length; ci++) { + Object.assign(team.characters[ci], [ + [ + {x: 0, y: 240, name: 'Ren'}, + {x: -40, y: 240, name: 'Fie'}, + {x: 40, y: 240, name: 'Grat'} + ], + [ + {x: -40, y: 200, name: 'Nomber A'}, + {x: 0, y: 200, name: 'Nomber B'}, + {x: 40, y: 200, name: 'Flaprat'} + ] + ][ti][ci]) + } +} const camera = battle.camera camera.width = canvas.width -- cgit 1.3.0-6-gf8a5