Les bars de vie et de bouclier s'adaptent en fonction de la hauteur du robot sur la carte => Si les barres ne peuvent pas s'afficher au dessus du robot, elles s'afficheront dorénavant en dessous - Ajout d'une page description des bonus

master
clmaisonha 5 years ago
parent 253322aae6
commit ce0709e676

File diff suppressed because one or more lines are too long

@ -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":3000}]}
{"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}]}

@ -0,0 +1,63 @@
class Description extends ManageLang {
constructor(father) {
super('Description', father);
}
create() {
super.create();
let x = WIDTH_WINDOW / 2;
let y = HEIGHT_WINDOW - 100;
let returnBtn = this.add.image(x, y, 'cancel').setOrigin(0.5, 0.5).setInteractive();
returnBtn.on('pointerover', () => returnBtn.setFrame(1));
returnBtn.on('pointerout', () => returnBtn.setFrame(0));
returnBtn.on('pointerdown', () => this.return());
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');
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');
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');
}
createCategoryBonus(x, y, width, height) {
x += 10;
y += 10;
this.add.rectangle(x, y, width, height, 0x868686).setOrigin(0, 0);
}
createBonusDescription(x, y, width, height, texture, name, text) {
x += 20;
y += 20;
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);
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);
style.font = (height / 6) + 'px stencil';
this.add.text(x, y + image.displayHeight + (height - image.displayHeight) / 2, text.toString(), style).setOrigin(0, 0.5);
}
return() {
this.father.scene.start('Game');
this.father.scene.remove('Description');
}
}

@ -1,5 +1,3 @@
var tree = undefined;
class Game extends ManageLang {
constructor(father, level = "level1") {
super('Game', father);
@ -316,12 +314,20 @@ class Game extends ManageLang {
}
clickSave() {
this.father.scene.stop('GamingBoard');
this.father.scene.remove('GamingBoard');
this.father.scene.add('Description', new Description(this.father, this));
this.scene.start('Description');
/*
let sortDesc = (a, b) => a.getX() - b.getX();
this.tree.sort(sortDesc);
let tree = this.tree.getJson();
let initStat = this.initStat.getJson();
let json = '{' + '"tree":' + tree + ',"initStat":' + initStat + '}';
console.log(json);
*/
}
clickPlay() {

@ -29,6 +29,9 @@ class Robot {
this.setSpeedReload(speedReload);
this.setRange(range);
this.setDamage(damage);
this.setX(this.x);
this.setY(this.y);
}
addScene(scene) {
@ -56,16 +59,27 @@ class Robot {
setX(x) {
this.x = x;
this.circle.setX(this.x);
this.life.setX(this.x);
this.shield.setX(this.x);
this.circle.setX(this.x);
this.drawCircleRange();
}
setY(y) {
this.y = y;
this.life.setY(this.y - this.width);
this.shield.setY(this.y - this.width * 1.5);
let yLife = this.y - this.width;
let yShield = this.y - this.width * 1.5;
if (yLife < 0) {
yShield = this.y + this.width - this.shield.height;
yLife = this.y + this.width * 1.5 - this.shield.height;
} else {
if (yShield < 0) {
yShield = yLife;
yLife = this.y + this.width - this.shield.height;
}
}
this.life.setY(yLife);
this.shield.setY(yShield);
this.circle.setY(this.y);
this.drawCircleRange();
}

@ -207,7 +207,7 @@
"x": 0.6,
"y": 0.9,
"value": 2,
"time": 3000
"time": 4000
}
]
}
Loading…
Cancel
Save