// You can write more code here
/* START OF COMPILED CODE */
class Scene1 extends Phaser.Scene {
constructor() {
super("Scene1");
}
_create() {
var money = this.add.image(356.5754, 392.0, "textures", "\u2014Pngtree\u2014vector dollar icon_4183947");
money.setScale(0.1, 0.1);
var pers = this.add.image(204.0, 362.0, "textures", "character_zombie_run1");
var pixil_frame_0__2_ = this.add.image(474.0, 386.0, "textures", "pixil-frame-0 (2)");
var meto = this.add.image(280.33298, 53.29235, "textures", "platformPack_tile004");
var meto1 = this.add.image(280.33298, 53.29235, "textures", "platformPack_tile004");
this.fBlock = money;
this.fPers = pers;
this.fEn = pixil_frame_0__2_;
this.fMeto = meto;
this.fMeto1 = meto1;
}
/* START-USER-CODE */
create() {
this._create();
this.cursors = this.input.keyboard.createCursorKeys();
this.physics.add.existing(this.fPers);
this.physics.add.existing(this.fBlock);
this.physics.add.existing(this.fMeto);
this.physics.add.existing(this.fMeto1);
this.physics.add.existing(this.fEn);
this.physics.add.overlap(this.fPers, this.fBlock, this.hit, null, this);
this.physics.add.overlap(this.fPers, this.fMeto, this.bim, null, this);
this.physics.add.overlap(this.fPers, this.fMeto1, this.bim1, null, this);
this.physics.add.overlap(this.fPers, this.fEn, this.ener, null, this);
this.createScore();
this.scoreText = this.add.text(16, 16, 'score: 0', {fontSize: "32px", fill: "#000"});
this.fMeto.visible = false;
this.fMeto1.visible = false;
this.speed = 3;
}
createScore() {
this.score = 0-1;
var scoreText;
}
ener() {
if (this.speed <= 5) {
this.speed += 2;
}else{
this.speed -= 2;
};
this.fEn.x = Phaser.Math.Between(100, 600);
this.fEn.y = Phaser.Math.Between(100, 450);
}
bim() {
this.fMeto.visible = false;
this.score = 0;
this.scoreText.setText('score: ' + this.score);
}
bim1() {
this.fMeto1.visible = false;
this.score = 0;
this.scoreText.setText('score: ' + this.score);
}
hit() {
this.fMeto.visible = true;
this.fMeto1.visible = true;
var p = 0;
this.fBlock.x = Phaser.Math.Between(100, 600);
this.fBlock.y = Phaser.Math.Between(150, 450);
var simplex = 280.33298;
this.score += 1;
this.scoreText.setText('score: ' + this.score);
this.fMeto.x = Phaser.Math.Between(100,600);
this.fMeto.body.gravity.y = 300;
this.fMeto.body.collideWorldBounds = true;
this.fMeto.y = 70;
this.fMeto1.x = Phaser.Math.Between(100,600);
this.fMeto1.body.gravity.y = 300;
this.fMeto1.body.collideWorldBounds = true;
this.fMeto1.y = 70;
}
update() {
var gamer = this.load.audio('theme', [
'assets/sounds/step.ogg',
'assets/sounds/step.mp3'
]);
if (this.cursors.down.isDown) {
this.fPers.y += this.speed;
var gamer = this.load.audio('theme', [
'assets/sounds/step.ogg',
'assets/sounds/step.mp3'
]);
var music = this.sound.add(gamer[0]);
music.play({
loop: true
});
}else if(this.cursors.up.isDown) {
var gamer = this.load.audio('theme', [
'assets/sounds/step.ogg',
'assets/sounds/step.mp3'
]);
this.fPers.y -= this.speed;
var music = this.sound.add(gamer[0]);
music.play({
loop: true
});
}else if(this.cursors.left.isDown) {
var gamer = this.load.audio('theme', [
'assets/sounds/step.ogg',
'assets/sounds/step.mp3'
]);
this.fPers.x -= this.speed;
var music = this.sound.add(gamer[0]);
music.play({
loop: true
});
}else if(this.cursors.right.isDown) {
var gamer = this.load.audio('theme', [
'assets/sounds/step.ogg',
'assets/sounds/step.mp3'
]);
this.fPers.x += this.speed;
var music = this.sound.add(gamer[0]);
music.play({
loop: true
});
}
}
/* END-USER-CODE */
}
/* END OF COMPILED CODE */
// You can write more code here