Я новичок помогите.
У меня ошибка с гравитацией.Ничего на экран не выводит.
Ошибка - Uncaught ReferenceError: preload is not defined Буду благодарен кто решит и объяснит что происходит. var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, render: render }); // 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"); this.fPers = pers; } /* START-USER-CODE */ create() { this._create(); game.stage.backgroundColor = '#2d2d2d'; game.physics.startSystem(Phaser.Physics.ARCADE); 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); var sprite2 = game.add.sprite(Phaser.Math.Between(100,600), 96, 'ilkke'); sprite2.body.collideWorldBounds = true; sprite2.body.bounce.y = 0.8; sprite2.body.gravity.y = 200; } 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 |
Часовой пояс GMT +3, время: 08:05. |