Вообщем дело в том что крашит из за строчки гравитации.
Помогите пожалуйста.Ошибка - Cannot read property 'gravity' of null
P.S: Ничего по тебе не нашел.
Спасибо!
// 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 meto = this.add.image(280.33298, 53.29235, "textures", "platformPack_tile004");
this.fPers = pers;
this.fBlock = money;
this.fMeto = meto;
}
/* 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.overlap(this.fPers, this.fBlock, this.hit, null, this);
this.createScore();
this.scoreText = this.add.text(16, 16, 'score: 0', {fontSize: "32px", fill: "#000"});
}
createScore() {
this.score = 0-1;
var scoreText;
}
hit() {
var p = 0;
this.fBlock.x = Phaser.Math.Between(100, 600);
this.fBlock.y = Phaser.Math.Between(100, 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;
player.body.collideWorldBounds = true;
}
update() {
if (this.cursors.down.isDown) {
this.fPers.y += 3;
}else if(this.cursors.up.isDown) {
this.fPers.y -= 3;
}else if(this.cursors.left.isDown) {
this.fPers.x -= 3;
}else if(this.cursors.right.isDown) {
this.fPers.x += 3;
}
}
/* END-USER-CODE */
}
/* END OF COMPILED CODE */
// You can write more code here