parent
bcd8e876a9
commit
66c292a919
File diff suppressed because one or more lines are too long
@ -0,0 +1,12 @@
|
||||
class BonusAttack extends Bonus {
|
||||
constructor(name, scene, x, y, value) {
|
||||
super(name, scene, x, y, 'bonusAttack', value);
|
||||
}
|
||||
|
||||
useOn(robot) {
|
||||
let oldSpeed = robot.speed;
|
||||
robot.setSpeed(oldSpeed + this.value);
|
||||
this.scene.time.addEvent({delay: this.time, callback: robot.setSpeed(oldSpeed)});
|
||||
this.destroy();
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
class BonusShield extends Bonus {
|
||||
constructor(name, scene, x, y, value) {
|
||||
super(name, scene, x, y, 'bonusShield', value);
|
||||
}
|
||||
|
||||
useOn(robot) {
|
||||
robot.shield.valueMax = robot.shield.valueMax + this.value;
|
||||
robot.shield.value = robot.shield.value + this.value;
|
||||
this.destroy();
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
class BonusSpeed extends Bonus {
|
||||
constructor(name, scene, x, y, value, time) {
|
||||
super(name, scene, x, y, 'bonusSpeed', value);
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
useOn(robot) {
|
||||
let oldSpeed = robot.speed;
|
||||
robot.setSpeed(oldSpeed + this.value);
|
||||
this.scene.time.addEvent({delay: this.time, callback: robot.setSpeed(oldSpeed)});
|
||||
this.destroy();
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
class Bonus extends Phaser.GameObjects.Image {
|
||||
constructor(name, scene, x, y, texture, value) {
|
||||
super(scene, x, y, texture);
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue