« get me outta code hell

Teams of three - csb-game - Pixelly spin-off of the Command Synergy Battle system used in Final Fantasy XIII
summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-08-12 11:27:30 -0300
committerFlorrie <towerofnix@gmail.com>2018-08-12 11:27:30 -0300
commit7b7d325595bdc2835c2bb556a334808fdefc864b (patch)
tree0c7bd173f31d9c6410cbffe0935d0d40c9f08c56
parent0722b8e060a09dd818fdc8ffbccebe513bb49af3 (diff)
Teams of three
-rw-r--r--index.js23
1 files 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