Modification du fonctionnement des bonus - Avant => A chaque apparition d'un bonus, il avait des caractéristiques qui lui sont propre => il pouvait donc ne pas avoir les même caractéristique qu'un autre bonus avec la même image - Maintenant => Les bonus sont chargés au début du jeu et/ou au changement de langue (en Json (listBonus.json)). Chaque image d'un bonus a un lien vers son bonus (on ne le duplique pas). Dorénavant, les caractéristiques des bonus se modifieront uniquement via la fichier Json - Finition de l'affichage des descriptions basiques des bonus => Gestion de la langue, gestion plus intelligente de la création de l'affichage, chargement des informations des bonus depuis les bonus eux-même - Lorsque notre robot meurt, ça termine automatiquement la partie

master
clmaisonha 5 years ago
parent ce0709e676
commit ac88349e39

@ -47,7 +47,8 @@ module.exports = function (grunt) {
'public/json//level2.json': ['src/json/level2.json'],
'public/json//level3.json': ['src/json/level3.json'],
'public/json//level4.json': ['src/json/level4.json'],
'public/json//level5.json': ['src/json/level5.json']
'public/json//level5.json': ['src/json/level5.json'],
'public/json//listBonus.json': ['src/json/listBonus.json']
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +1 @@
{"tree":{"type":"waria","lRect":[{"type":"move","option":[true,false]},{"type":"attack","option":[0.3333333333333333]},{"type":"condition","option":[true,true,false,0.3333333333333333,0],"lRect":[{"type":"move","option":[false,true]},{"type":"attack","option":[1]}]},{"type":"move","option":[true,true]}]},"initStat":{"lBar":[{"value":2,"valueMax":5,"color":16711680,"colorMin":16711680},{"value":3,"valueMax":5,"color":8323327,"colorMin":8323327},{"value":3,"valueMax":5,"color":255,"colorMin":255},{"value":2,"valueMax":5,"color":32768,"colorMin":32768}],"lText":[["DAMAGE","DEGATS"],["R.S","RECHARGEMENT"],["SPEED","VITESSE"],["RANGE","PORTEE"]]},"robots":[{"height":0.1,"width":0.1,"x":0.9,"y":0.9,"name":"myself","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[]},{"height":0.1,"width":0.1,"x":0.1,"y":0.1,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.1,"y":0.9,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]}],"lBonus":[{"style":"speed","x":0.5,"y":0.5,"value":3,"time":2000}]}
{"tree":{"type":"waria","lRect":[{"type":"move","option":[true,false]},{"type":"attack","option":[0.3333333333333333]},{"type":"condition","option":[true,true,false,0.3333333333333333,0],"lRect":[{"type":"move","option":[false,true]},{"type":"attack","option":[1]}]},{"type":"move","option":[true,true]}]},"initStat":{"lBar":[{"value":2,"valueMax":5,"color":16711680,"colorMin":16711680},{"value":3,"valueMax":5,"color":8323327,"colorMin":8323327},{"value":3,"valueMax":5,"color":255,"colorMin":255},{"value":2,"valueMax":5,"color":32768,"colorMin":32768}],"lText":[["DAMAGE","DEGATS"],["R.S","RECHARGEMENT"],["SPEED","VITESSE"],["RANGE","PORTEE"]]},"robots":[{"height":0.1,"width":0.1,"x":0.9,"y":0.9,"name":"myself","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[]},{"height":0.1,"width":0.1,"x":0.1,"y":0.1,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.1,"y":0.9,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]}],"lBonus":[{"style":"shield","number":0,"x":0.5,"y":0.5}]}

@ -1 +1 @@
{"tree":{"type":"waria","lRect":[{"type":"condition","option":[true,true,false,0.3333333333333333,0],"lRect":[{"type":"move","option":[true,false]}]},{"type":"attack","option":[0.3333333333333333]},{"type":"move","option":[true,true]}]},"initStat":{"lBar":[{"value":0,"valueMax":5,"color":16711680,"colorMin":16711680},{"value":0,"valueMax":5,"color":8323327,"colorMin":8323327},{"value":5,"valueMax":5,"color":255,"colorMin":255},{"value":5,"valueMax":5,"color":32768,"colorMin":32768}],"lText":[["DAMAGE","DEGATS"],["R.S","RECHARGEMENT"],["SPEED","VITESSE"],["RANGE","PORTEE"]]},"robots":[{"height":0.1,"width":0.1,"x":0.9,"y":0.9,"name":"myself","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[]},{"height":0.1,"width":0.1,"x":0.1,"y":0.1,"name":"enemy","speed":1,"speedReload":1,"range":5,"damage":5,"lNode":[{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.3,"y":0.1,"name":"enemy","speed":1,"speedReload":1,"range":5,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.7,"y":0.1,"name":"enemy","speed":1,"speedReload":1,"range":5,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.5,"y":0.4,"name":"enemy","speed":1,"speedReload":1,"range":5,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.1,"y":0.9,"name":"enemy","speed":1,"speedReload":1,"range":5,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.3,"y":0.7,"name":"enemy","speed":1,"speedReload":1,"range":5,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.9,"y":0.2,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]}],"lBonus":[{"style":"speed","x":0.5,"y":0.5,"value":1,"time":8000},{"style":"shield","x":0.2,"y":0.9,"value":75,"time":15000,"color":8323327},{"style":"shield","x":0.8,"y":0.4,"value":125,"time":10000,"color":8323327},{"style":"shield","x":0.2,"y":0.2,"value":200,"time":5000,"color":8323327}]}
{"tree":{"type":"waria","lRect":[{"type":"condition","option":[true,true,false,0.3333333333333333,0],"lRect":[{"type":"move","option":[true,false]}]},{"type":"attack","option":[0.3333333333333333]},{"type":"move","option":[true,true]}]},"initStat":{"lBar":[{"value":0,"valueMax":5,"color":16711680,"colorMin":16711680},{"value":0,"valueMax":5,"color":8323327,"colorMin":8323327},{"value":5,"valueMax":5,"color":255,"colorMin":255},{"value":5,"valueMax":5,"color":32768,"colorMin":32768}],"lText":[["DAMAGE","DEGATS"],["R.S","RECHARGEMENT"],["SPEED","VITESSE"],["RANGE","PORTEE"]]},"robots":[{"height":0.1,"width":0.1,"x":0.9,"y":0.9,"name":"myself","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[]},{"height":0.1,"width":0.1,"x":0.1,"y":0.1,"name":"enemy","speed":1,"speedReload":1,"range":5,"damage":5,"lNode":[{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.3,"y":0.1,"name":"enemy","speed":1,"speedReload":1,"range":5,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.7,"y":0.1,"name":"enemy","speed":1,"speedReload":1,"range":5,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.5,"y":0.4,"name":"enemy","speed":1,"speedReload":1,"range":5,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.1,"y":0.9,"name":"enemy","speed":1,"speedReload":1,"range":5,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.3,"y":0.7,"name":"enemy","speed":1,"speedReload":1,"range":5,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.9,"y":0.2,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]}],"lBonus":[{"style":"speed","number":0,"x":0.5,"y":0.5},{"style":"attack","number":2,"x":0.7,"y":0.7},{"style":"shield","number":0,"x":0.2,"y":0.9},{"style":"shield","number":1,"x":0.8,"y":0.4},{"style":"shield","number":2,"x":0.2,"y":0.2}]}

@ -1 +1 @@
{"tree":{"type":"waria","lRect":[{"type":"attack","option":[0.3333333333333333]},{"type":"condition","option":[false,false,true,0.3333333333333333,1],"lRect":[{"type":"move","option":[false,true]},{"type":"attack","option":[1]}]},{"type":"move","option":[true,false]},{"type":"move","option":[true,true]}]},"initStat":{"lBar":[{"value":5,"valueMax":5,"color":16711680,"colorMin":16711680},{"value":0,"valueMax":5,"color":8323327,"colorMin":8323327},{"value":0,"valueMax":5,"color":255,"colorMin":255},{"value":5,"valueMax":5,"color":32768,"colorMin":32768}],"lText":[["DAMAGE","DEGATS"],["R.S","RECHARGEMENT"],["SPEED","VITESSE"],["RANGE","PORTEE"]]},"robots":[{"height":0.1,"width":0.1,"x":0.9,"y":0.9,"name":"myself","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[]},{"height":0.1,"width":0.1,"x":0.5,"y":0.1,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.1,"y":0.9,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]}],"lBonus":[{"style":"speed","x":0.5,"y":0.5,"value":1,"time":2000}]}
{"tree":{"type":"waria","lRect":[{"type":"attack","option":[0.3333333333333333]},{"type":"condition","option":[false,false,true,0.3333333333333333,1],"lRect":[{"type":"move","option":[false,true]},{"type":"attack","option":[1]}]},{"type":"move","option":[true,false]},{"type":"move","option":[true,true]}]},"initStat":{"lBar":[{"value":5,"valueMax":5,"color":16711680,"colorMin":16711680},{"value":0,"valueMax":5,"color":8323327,"colorMin":8323327},{"value":0,"valueMax":5,"color":255,"colorMin":255},{"value":5,"valueMax":5,"color":32768,"colorMin":32768}],"lText":[["DAMAGE","DEGATS"],["R.S","RECHARGEMENT"],["SPEED","VITESSE"],["RANGE","PORTEE"]]},"robots":[{"height":0.1,"width":0.1,"x":0.9,"y":0.9,"name":"myself","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[]},{"height":0.1,"width":0.1,"x":0.5,"y":0.1,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.1,"y":0.9,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]}],"lBonus":[{"style":"speed","number":0,"x":0.5,"y":0.5}]}

@ -1 +1 @@
{"tree":{"type":"waria","lRect":[{"type":"condition","option":[false,false,true,0.3333333333333333,1],"lRect":[{"type":"move","option":[false,true]},{"type":"attack","option":[1]}]},{"type":"attack","option":[0.3333333333333333]},{"type":"move","option":[true,false]},{"type":"move","option":[true,true]}]},"initStat":{"lBar":[{"value":5,"valueMax":5,"color":16711680,"colorMin":16711680},{"value":5,"valueMax":5,"color":8323327,"colorMin":8323327},{"value":0,"valueMax":5,"color":255,"colorMin":255},{"value":0,"valueMax":5,"color":32768,"colorMin":32768}],"lText":[["DAMAGE","DEGATS"],["R.S","RECHARGEMENT"],["SPEED","VITESSE"],["RANGE","PORTEE"]]},"robots":[{"height":0.1,"width":0.1,"x":0.9,"y":0.9,"name":"myself","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[]},{"height":0.1,"width":0.1,"x":0.1,"y":0.1,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.3,"y":0.5,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]}],"lBonus":[{"style":"speed","x":0.5,"y":0.5,"value":3,"time":2000},{"style":"speed","x":0.6,"y":0.9,"value":2,"time":4000}]}
{"tree":{"type":"waria","lRect":[{"type":"condition","option":[false,false,true,0.3333333333333333,1],"lRect":[{"type":"move","option":[false,true]},{"type":"attack","option":[1]}]},{"type":"attack","option":[0.3333333333333333]},{"type":"move","option":[true,false]},{"type":"move","option":[true,true]}]},"initStat":{"lBar":[{"value":5,"valueMax":5,"color":16711680,"colorMin":16711680},{"value":5,"valueMax":5,"color":8323327,"colorMin":8323327},{"value":0,"valueMax":5,"color":255,"colorMin":255},{"value":0,"valueMax":5,"color":32768,"colorMin":32768}],"lText":[["DAMAGE","DEGATS"],["R.S","RECHARGEMENT"],["SPEED","VITESSE"],["RANGE","PORTEE"]]},"robots":[{"height":0.1,"width":0.1,"x":0.9,"y":0.9,"name":"myself","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[]},{"height":0.1,"width":0.1,"x":0.1,"y":0.1,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.3,"y":0.5,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]}],"lBonus":[{"style":"speed","number":2,"x":0.5,"y":0.5},{"style":"speed","number":1,"x":0.6,"y":0.9}]}

@ -1 +1 @@
{"tree":{"type":"waria","lRect":[{"type":"attack","option":[0.3333333333333333]},{"type":"move","option":[true,false]},{"type":"condition","option":[true,true,false,0.3333333333333333,0],"lRect":[{"type":"move","option":[false,true]},{"type":"attack","option":[1]}]},{"type":"move","option":[true,true]}]},"initStat":{"lBar":[{"value":3,"valueMax":5,"color":16711680,"colorMin":16711680},{"value":2,"valueMax":5,"color":8323327,"colorMin":8323327},{"value":0,"valueMax":5,"color":255,"colorMin":255},{"value":5,"valueMax":5,"color":32768,"colorMin":32768}],"lText":[["DAMAGE","DEGATS"],["R.S","RECHARGEMENT"],["SPEED","VITESSE"],["RANGE","PORTEE"]]},"robots":[{"height":0.1,"width":0.1,"x":0.6,"y":0.6,"name":"myself","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[]},{"height":0.1,"width":0.1,"x":0.1,"y":0.1,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.1,"y":0.9,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]}],"lBonus":[{"style":"speed","x":0.5,"y":0.5,"value":2,"time":2000}]}
{"tree":{"type":"waria","lRect":[{"type":"attack","option":[0.3333333333333333]},{"type":"move","option":[true,false]},{"type":"condition","option":[true,true,false,0.3333333333333333,0],"lRect":[{"type":"move","option":[false,true]},{"type":"attack","option":[1]}]},{"type":"move","option":[true,true]}]},"initStat":{"lBar":[{"value":3,"valueMax":5,"color":16711680,"colorMin":16711680},{"value":2,"valueMax":5,"color":8323327,"colorMin":8323327},{"value":0,"valueMax":5,"color":255,"colorMin":255},{"value":5,"valueMax":5,"color":32768,"colorMin":32768}],"lText":[["DAMAGE","DEGATS"],["R.S","RECHARGEMENT"],["SPEED","VITESSE"],["RANGE","PORTEE"]]},"robots":[{"height":0.1,"width":0.1,"x":0.6,"y":0.6,"name":"myself","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[]},{"height":0.1,"width":0.1,"x":0.1,"y":0.1,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]},{"height":0.1,"width":0.1,"x":0.1,"y":0.9,"name":"enemy","speed":3,"speedReload":1,"range":3,"damage":5,"lNode":[{"name":"condition","option":[true,true,false,0.5,0],"lNode":[{"name":"move","option":[false]}]},{"name":"attack","option":[]},{"name":"move","option":[true]}]}],"lBonus":[{"style":"speed","number":1,"x":0.5,"y":0.5}]}

@ -0,0 +1 @@
{"lSpeedBonus":[{"name":{"en":"SPEED BRONZE","fr":"VITESSE BRONZE"},"texture":"bonusSpeed0","value":2,"time":6000},{"name":{"en":"SPEED SILVER","fr":"VITESSE ARGENT"},"texture":"bonusSpeed1","value":3,"time":4000},{"name":{"en":"SPEED GOLD","fr":"VITESSE OR"},"texture":"bonusSpeed2","value":4,"time":2000}],"lAttackBonus":[{"name":{"en":"ATTACK BRONZE","fr":"ATTAQUE BRONZE"},"texture":"bonusAttack0","value":2},{"name":{"en":"ATTACK SILVER","fr":"ATTAQUE ARGENT"},"texture":"bonusAttack1","value":3},{"name":{"en":"ATTACK GOLD","fr":"ATTAQUE OR"},"texture":"bonusAttack2","value":4}],"lShieldBonus":[{"name":{"en":"SHIELD BRONZE","fr":"BOUCLIER BRONZE"},"texture":"bonusShield0","value":75,"time":15000,"color":8021041},{"name":{"en":"SHIELD SILVER","fr":"BOUCLIER ARGENT"},"texture":"bonusShield1","value":125,"time":10000,"color":10066083},{"name":{"en":"SHIELD GOLD","fr":"BOUCLIER OR"},"texture":"bonusShield2","value":200,"time":5000,"color":13093166}]}

@ -1,25 +1,9 @@
class BonusAttack extends Bonus {
constructor(name, scene, x, y, value) {
let bonus;
switch (value) {
case 1:
bonus = 'bonusAttack0';
break;
case 2:
bonus = 'bonusAttack1';
break;
case 3:
bonus = 'bonusAttack2';
break;
default:
bonus = 'bonusAttack2';
break;
}
super(name, scene, x, y, bonus, value);
constructor(name, texture, value) {
super(name, texture, value);
}
useOn(robot) {
robot.setAttackBonus(this.value + 1);
this.destroy();
robot.setAttackBonus(this.value);
}
}

@ -1,32 +1,16 @@
class BonusShield extends Bonus {
constructor(name, scene, x, y, value, time, color) {
let bonus;
switch (value) {
case 75:
bonus = 'bonusShield0';
break;
case 125:
bonus = 'bonusShield1';
break;
case 200:
bonus = 'bonusShield2';
break;
default:
bonus = 'bonusShield2';
break;
}
super(name, scene, x, y, bonus, value);
constructor(name, texture, value, time, color) {
super(name, texture, value);
this.time = time;
this.color = color;
}
useOn(robot) {
useOn(robot, scene) {
let oldColor = robot.shield.color;
robot.shield.increaseValueMax(this.value, this.color);
this.scene.time.addEvent({
scene.time.addEvent({
delay: this.time,
callback: () => robot.shield.decreaseValueMax(this.value, oldColor)
});
this.destroy();
}
}

@ -1,27 +1,11 @@
class BonusSpeed extends Bonus {
constructor(name = "", scene, x, y, value, time) {
let bonus;
switch (value) {
case 1:
bonus = 'bonusSpeed0';
break;
case 2:
bonus = 'bonusSpeed1';
break;
case 3:
bonus = 'bonusSpeed2';
break;
default:
bonus = 'bonusSpeed2';
break;
}
super(name, scene, x, y, bonus, value);
constructor(name = "", texture, value, time) {
super(name, texture, value);
this.time = time;
}
useOn(robot) {
robot.increaseSpeedBonus(this.value);
this.scene.time.addEvent({delay: this.time, callback: () => robot.decreaseSpeedBonus(this.value)});
this.destroy();
useOn(robot, scene) {
robot.increaseSpeedBonus(this.value - 1);
scene.time.addEvent({delay: this.time, callback: () => robot.decreaseSpeedBonus(this.value - 1)});
}
}

@ -0,0 +1,15 @@
class BonusView extends Phaser.GameObjects.Image {
constructor(scene, x, y, bonus) {
super(scene, x, y, bonus.texture);
this.setOrigin(0.5, 0.5);
this.displayHeight = HEIGHT_BONUS;
this.scaleX = this.scaleY;
scene.add.existing(this);
this.bonus = bonus;
}
useOn(robot) {
this.bonus.useOn(robot, this.scene);
this.destroy();
}
}

@ -14,25 +14,39 @@ class Description extends ManageLang {
returnBtn.displayHeight = HEIGHT_WINDOW / 10;
returnBtn.scaleX = returnBtn.scaleY;
let width = WIDTH_WINDOW / 3 - 20;
let height = HEIGHT_WINDOW / 4 * 3;
x = 0;
y = 0;
this.createCategoryBonus(x, 0, width, height);
this.createBonusDescription(x, 0, width, height / 3, 'bonusShield0', 'BOUCLIER BRONZE', 'BONUS : +75 - TIME : 15');
this.createBonusDescription(x, height / 3, width, height / 3, 'bonusShield1', 'BOUCLIER ARGENT', 'BONUS : +125 - TIME : 10');
this.createBonusDescription(x, height / 1.5, width, height / 3, 'bonusShield2', 'BOUCLIER OR', 'BONUS : +200 - TIME : 5');
this.loadBonus();
}
loadBonus() {
this.width = WIDTH_WINDOW / 3 - 20;
this.height = HEIGHT_WINDOW / 4;
let x = 0;
this.createList(lShieldBonus, x, true);
x = WIDTH_WINDOW / 3;
this.createCategoryBonus(x, 0, width, height);
this.createBonusDescription(x, 0, width, height / 3, 'bonusSpeed0', 'VITESSE BRONZE', 'BONUS : x2 - TIME : 8');
this.createBonusDescription(x, height / 3, width, height / 3, 'bonusSpeed1', 'VITESSE ARGENT', 'BONUS : x3 - TIME : 4');
this.createBonusDescription(x, height / 1.5, width, height / 3, 'bonusSpeed2', 'VITESSE OR', 'BONUS : x4 - TIME : 2');
this.createList(lSpeedBonus, x, false);
x = WIDTH_WINDOW / 1.5;
this.createCategoryBonus(x, 0, width, height);
this.createBonusDescription(x, 0, width, height / 3, 'bonusAttack0', 'ATTAQUE BRONZE', 'BONUS : x2');
this.createBonusDescription(x, height / 3, width, height / 3, 'bonusAttack1', 'ATTAQUE ARGENT', 'BONUS : x3');
this.createBonusDescription(x, height / 1.5, width, height / 3, 'bonusAttack2', 'ATTAQUE OR', 'BONUS : x4');
this.createList(lAttackBonus, x, false);
}
createList(listBonus, x, add = true) {
let y = 50;
this.createCategoryBonus(x, y, this.width, this.height * listBonus.length);
listBonus.forEach(bonus => {
let time = "";
if (bonus.time !== undefined) {
time = ' - ' + selectWord("TIME", "TEMPS") + ' : ' + (bonus.time / 1000);
}
let value = "";
if (bonus.value !== undefined) {
let sign = 'x';
if (add) {
sign = '+';
}
value = 'BONUS : ' + sign + bonus.value;
}
this.createBonusDescription(x, y, this.width, this.height, bonus.texture, bonus.name, value + time);
y += this.height;
});
}
createCategoryBonus(x, y, width, height) {
@ -47,13 +61,13 @@ class Description extends ManageLang {
width -= 20;
height -= 20;
this.add.rectangle(x, y, width, height, 0xFFFFFF).setOrigin(0, 0);
let image = this.add.image(x, y, texture).setOrigin(0, 0);
let image = this.add.image(x + 5, y + 5, texture).setOrigin(0, 0);
image.displayHeight = 100;
image.scaleX = image.scaleY;
let style = {font: (image.displayHeight / 2 - name.length) + 'px stencil', fill: "#000000"};
this.add.text(x + image.displayWidth + 10, y + image.displayHeight / 2, name.toString(), style).setOrigin(0, 0.5);
this.add.text(x + image.displayWidth + 10, y + 5 + image.displayHeight / 2, name.toString(), style).setOrigin(0, 0.5);
style.font = (height / 6) + 'px stencil';
this.add.text(x, y + image.displayHeight + (height - image.displayHeight) / 2, text.toString(), style).setOrigin(0, 0.5);
this.add.text(x + 5, y + image.displayHeight + (height - image.displayHeight) / 2, text.toString(), style).setOrigin(0, 0.5);
}
return() {

@ -152,17 +152,22 @@ class Game extends ManageLang {
})
}
loadB(bonus) {
switch (bonus.style) {
loadB(element) {
let bonus;
switch (element.style) {
case "speed":
return new BonusSpeed("", this.gm, WIDTH_MAP * bonus.x, WIDTH_MAP * bonus.y, bonus.value, bonus.time);
bonus = lSpeedBonus[element.number];
break;
case "attack":
return new BonusAttack("", this.gm, WIDTH_MAP * bonus.x, WIDTH_MAP * bonus.y, bonus.value);
bonus = lAttackBonus[element.number];
break;
case "shield":
return new BonusShield("", this.gm, WIDTH_MAP * bonus.x, WIDTH_MAP * bonus.y, bonus.value, bonus.time, bonus.color);
bonus = lShieldBonus[element.number];
break;
default:
return null;
}
return new BonusView(this.gm, element.x * WIDTH_MAP, element.y * WIDTH_MAP, bonus);
}
finish() {
@ -354,7 +359,6 @@ class Game extends ManageLang {
clickPencil() {
if (this.selected !== null) {
console.log("PENCIL");
this.changeFrame(this.pencil, 0);
switch (this.selected.type) {
case 'attack':
this.father.scene.add('AddNode', new AddAttack(this.father, this, this.selected, false, this.selected.node.percentRange));

@ -18,30 +18,32 @@ class GamingBoard extends Phaser.Scene {
background.alpha = 0.3;
background.displayWidth = WIDTH_MAP;
background.displayHeight = WIDTH_MAP;
this.time.addEvent({delay: 2000, callback: this.upShield, callbackScope: this});
}
update(time, delta) {
super.update(time, delta);
this.listRobot.forEach(function (robot) {
robot.read();
})
for (let i = 0; i < this.listRobot.length; i++) {
if (!this.listRobot[i].isAlive()) {
this.listRobot.splice(i, 1);
i -= 1;
} else {
if (!this.listRobot[i].haveTarget()) {
this.listRobot[i].setTarget(chooseTarget(this.listRobot[i], this.listRobot));
if (!this.end) {
this.listRobot.forEach(function (robot) {
robot.read();
})
for (let i = 0; i < this.listRobot.length; i++) {
if (!this.listRobot[i].isAlive()) {
this.listRobot.splice(i, 1);
i -= 1;
} else {
if (!this.listRobot[i].haveTarget()) {
this.listRobot[i].setTarget(chooseTarget(this.listRobot[i], this.listRobot));
}
}
}
}
if (this.listRobot.length <= 1 && !this.end) {
this.end = true;
this.finish();
if (this.getMyRobot() === undefined || this.listRobot.length <= 1) {
this.end = true;
this.finish();
}
}
}

@ -26,13 +26,8 @@ class LoadFile extends Phaser.Scene {
progressBar.fillRect(x + 10, y + 10, (width - 20) * value, height - 20);
});
this.load.on('complete', () => {
progressBar.destroy();
progressBox.destroy();
if (this.father.scene.getIndex(this.nameSon) === -1) {
this.father.scene.add(this.nameSon, this.son);
}
this.father.scene.start(this.nameSon);
});
this.load.audio('shot', 'assets/sounds/shot.ogg');
@ -103,6 +98,31 @@ class LoadFile extends Phaser.Scene {
this.loadImage('attack', 'nodes/', true);
this.loadImage('move', 'nodes/', true);
this.loadImage('condition', 'nodes/', true);
if (this.cache.json.exists('listBonus')) {
this.cache.json.remove('listBonus');
lSpeedBonus = [];
lShieldBonus = [];
lAttackBonus = [];
}
this.load.json('listBonus', 'public/json/listBonus.json');
}
create() {
this.loadBonus();
if (this.father.scene.getIndex(this.nameSon) === -1) {
this.father.scene.add(this.nameSon, this.son);
}
this.father.scene.start(this.nameSon);
}
loadBonus() {
let listBonus = this.cache.json.get('listBonus');
if (listBonus !== undefined) {
listBonus.lSpeedBonus.forEach(bonus => lSpeedBonus.push(new BonusSpeed(selectWord(bonus.name.en, bonus.name.fr), bonus.texture, bonus.value, bonus.time)));
listBonus.lShieldBonus.forEach(bonus => lShieldBonus.push(new BonusShield(selectWord(bonus.name.en, bonus.name.fr), bonus.texture, bonus.value, bonus.time, bonus.color)));
listBonus.lAttackBonus.forEach(bonus => lAttackBonus.push(new BonusAttack(selectWord(bonus.name.en, bonus.name.fr), bonus.texture, bonus.value)));
}
}
loadSprite(name, width, height, folder = '', force = false) {

@ -1,6 +1,9 @@
var listBonus = [];
var LANG = navigator.language.substr(0, 2).toLowerCase();
var SPEED_GAME = 1;
var lSpeedBonus = [];
var lShieldBonus = [];
var lAttackBonus = [];
const MYSELF = 'myself';
const SHIELD_PER_SECOND = 5;
const COLOR_ATTACK = 0xff0000;

@ -1,12 +1,7 @@
class Bonus extends Phaser.GameObjects.Image {
constructor(name, scene, x, y, texture, value) {
super(scene, x, y, texture);
this.setOrigin(0.5, 0.5);
this.displayHeight = HEIGHT_BONUS;
this.scaleX = this.scaleY;
scene.add.existing(this);
class Bonus {
constructor(name, texture, value) {
this.texture = texture;
this.name = name;
this.value = value;
this.scene = scene;
}
}

@ -196,11 +196,10 @@
],
"lBonus": [
{
"style": "speed",
"style": "shield",
"number": 0,
"x": 0.5,
"y": 0.5,
"value": 3,
"time": 2000
"y": 0.5
}
]
}

@ -376,34 +376,33 @@
"lBonus": [
{
"style": "speed",
"number": 0,
"x": 0.5,
"y": 0.5,
"value": 1,
"time": 8000
"y": 0.5
},
{
"style": "attack",
"number": 2,
"x": 0.7,
"y": 0.7
},
{
"style": "shield",
"number": 0,
"x": 0.2,
"y": 0.9,
"value": 75,
"time": 15000,
"color": 8323327
"y": 0.9
},
{
"style": "shield",
"number": 1,
"x": 0.8,
"y": 0.4,
"value": 125,
"time": 10000,
"color": 8323327
"y": 0.4
},
{
"style": "shield",
"number": 2,
"x": 0.2,
"y": 0.2,
"value": 200,
"time": 5000,
"color": 8323327
"y": 0.2
}
]
}

@ -197,10 +197,9 @@
"lBonus": [
{
"style": "speed",
"number": 0,
"x": 0.5,
"y": 0.5,
"value": 1,
"time": 2000
"y": 0.5
}
]
}

@ -197,17 +197,15 @@
"lBonus": [
{
"style": "speed",
"number": 2,
"x": 0.5,
"y": 0.5,
"value": 3,
"time": 2000
"y": 0.5
},
{
"style": "speed",
"number": 1,
"x": 0.6,
"y": 0.9,
"value": 2,
"time": 4000
"y": 0.9
}
]
}

@ -197,10 +197,9 @@
"lBonus": [
{
"style": "speed",
"number": 1,
"x": 0.5,
"y": 0.5,
"value": 2,
"time": 2000
"y": 0.5
}
]
}

@ -0,0 +1,89 @@
{
"lSpeedBonus": [
{
"name": {
"en": "SPEED BRONZE",
"fr": "VITESSE BRONZE"
},
"texture": "bonusSpeed0",
"value": 2,
"time": 6000
},
{
"name": {
"en": "SPEED SILVER",
"fr": "VITESSE ARGENT"
},
"texture": "bonusSpeed1",
"value": 3,
"time": 4000
},
{
"name": {
"en": "SPEED GOLD",
"fr": "VITESSE OR"
},
"texture": "bonusSpeed2",
"value": 4,
"time": 2000
}
],
"lAttackBonus": [
{
"name": {
"en": "ATTACK BRONZE",
"fr": "ATTAQUE BRONZE"
},
"texture": "bonusAttack0",
"value": 2
},
{
"name": {
"en": "ATTACK SILVER",
"fr": "ATTAQUE ARGENT"
},
"texture": "bonusAttack1",
"value": 3
},
{
"name": {
"en": "ATTACK GOLD",
"fr": "ATTAQUE OR"
},
"texture": "bonusAttack2",
"value": 4
}
],
"lShieldBonus": [
{
"name": {
"en": "SHIELD BRONZE",
"fr": "BOUCLIER BRONZE"
},
"texture": "bonusShield0",
"value": 75,
"time": 15000,
"color": 8021041
},
{
"name": {
"en": "SHIELD SILVER",
"fr": "BOUCLIER ARGENT"
},
"texture": "bonusShield1",
"value": 125,
"time": 10000,
"color": 10066083
},
{
"name": {
"en": "SHIELD GOLD",
"fr": "BOUCLIER OR"
},
"texture": "bonusShield2",
"value": 200,
"time": 5000,
"color": 13093166
}
]
}
Loading…
Cancel
Save