Les points de boucliers se régénèrent en fonction du temps (5 pas seconde) - Affichage d'un cercle pour afficher la distance de tir du cercle bleu - Création des différentes scène qui gereront par la suite la création propre à chaque action (attaquer, déplacement, condition). Pour le moment, il y a beaucoup de code en double entre ces scènes car elles ont le même principe de fonctionnement. Elles seront par la suite regroupé par un père.
parent
ae086c87a1
commit
9a062269ce
@ -1 +1 @@
|
|||||||
const COLOR_ATTACK=16711680,COLOR_MOVE=255,COLOR_CONDITION=921102,WIDTH_WINDOW=$(document).width()-20,HEIGHT_WINDOW=$(document).height()-20,WIDTH_MAP=WIDTH_WINDOW<HEIGHT_WINDOW?.8*WIDTH_WINDOW:.8*HEIGHT_WINDOW,SPEED=2,LIFE=100,DAMAGE=40,SHIELD=100,RANGE=WIDTH_MAP/2;var config={type:Phaser.AUTO,width:WIDTH_WINDOW,height:HEIGHT_WINDOW,parent:"all",backgroundColor:"#35363A"},game=new Phaser.Game(config);game.scene.add("Boot",Boot),game.scene.add("Type",Type),game.scene.add("Game",new Game(game)),game.scene.start("Boot");
|
const SHIELD_PER_SECOND=5,COLOR_ATTACK=16711680,COLOR_MOVE=255,COLOR_CONDITION=921102,WIDTH_WINDOW=$(document).width()-20,HEIGHT_WINDOW=$(document).height()-20,WIDTH_MAP=WIDTH_WINDOW<HEIGHT_WINDOW?.8*WIDTH_WINDOW:.8*HEIGHT_WINDOW,SPEED=2,LIFE=100,DAMAGE=40,SHIELD=100,RANGE=WIDTH_MAP/2;var config={type:Phaser.AUTO,width:WIDTH_WINDOW,height:HEIGHT_WINDOW,parent:"all",backgroundColor:"#35363A"},game=new Phaser.Game(config);game.scene.add("Boot",Boot),game.scene.add("Type",Type),game.scene.add("Game",new Game(game)),game.scene.start("Boot");
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,29 @@
|
|||||||
|
class AddAttack extends Phaser.Scene {
|
||||||
|
constructor(game) {
|
||||||
|
super('addNode');
|
||||||
|
this.game = game;
|
||||||
|
}
|
||||||
|
|
||||||
|
create() {
|
||||||
|
this.add.rectangle(0, 0, WIDTH_WINDOW, HEIGHT_WINDOW, 0x000000).setOrigin(0, 0).setAlpha(0.5);
|
||||||
|
console.log("ATTACK");
|
||||||
|
this.createButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
createButton() {
|
||||||
|
let x = WIDTH_WINDOW / 2;
|
||||||
|
let y = HEIGHT_WINDOW - 100;
|
||||||
|
this.cancelBtn = this.add.image(x, y, 'cancel').setOrigin(0.5, 0.5).setInteractive();
|
||||||
|
this.cancelBtn.on('pointerover', () => this.cancelBtn.setFrame(1));
|
||||||
|
this.cancelBtn.on('pointerout', () => this.cancelBtn.setFrame(0));
|
||||||
|
this.cancelBtn.on('pointerdown', () => this.cancel());
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel() {
|
||||||
|
this.scene.resume('Game');
|
||||||
|
this.scene.stop('addNode');
|
||||||
|
this.game.scene.remove('addNode');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
class AddCondition extends Phaser.Scene {
|
||||||
|
constructor(game) {
|
||||||
|
super('addNode');
|
||||||
|
this.game = game;
|
||||||
|
}
|
||||||
|
|
||||||
|
create() {
|
||||||
|
this.add.rectangle(0, 0, WIDTH_WINDOW, HEIGHT_WINDOW, 0x000000).setOrigin(0, 0).setAlpha(0.5);
|
||||||
|
console.log("CONDITION");
|
||||||
|
this.createButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
createButton() {
|
||||||
|
let x = WIDTH_WINDOW / 2;
|
||||||
|
let y = HEIGHT_WINDOW - 100;
|
||||||
|
this.cancelBtn = this.add.image(x, y, 'cancel').setOrigin(0.5, 0.5).setInteractive();
|
||||||
|
this.cancelBtn.on('pointerover', () => this.cancelBtn.setFrame(1));
|
||||||
|
this.cancelBtn.on('pointerout', () => this.cancelBtn.setFrame(0));
|
||||||
|
this.cancelBtn.on('pointerdown', () => this.cancel());
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel() {
|
||||||
|
this.scene.resume('Game');
|
||||||
|
this.scene.stop('addNode');
|
||||||
|
this.game.scene.remove('addNode');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
class AddMove extends Phaser.Scene {
|
||||||
|
constructor(game) {
|
||||||
|
super('addNode');
|
||||||
|
this.game = game;
|
||||||
|
}
|
||||||
|
|
||||||
|
create() {
|
||||||
|
this.add.rectangle(0, 0, WIDTH_WINDOW, HEIGHT_WINDOW, 0x000000).setOrigin(0, 0).setAlpha(0.5);
|
||||||
|
console.log("MOVE");
|
||||||
|
this.createButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
createButton() {
|
||||||
|
let x = WIDTH_WINDOW / 2;
|
||||||
|
let y = HEIGHT_WINDOW - 100;
|
||||||
|
this.cancelBtn = this.add.image(x, y, 'cancel').setOrigin(0.5, 0.5).setInteractive();
|
||||||
|
this.cancelBtn.on('pointerover', () => this.cancelBtn.setFrame(1));
|
||||||
|
this.cancelBtn.on('pointerout', () => this.cancelBtn.setFrame(0));
|
||||||
|
this.cancelBtn.on('pointerdown', () => this.cancel());
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel() {
|
||||||
|
this.scene.resume('Game');
|
||||||
|
this.scene.stop('addNode');
|
||||||
|
this.game.scene.remove('addNode');
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue