Genkics Posted March 9, 2019 Share Posted March 9, 2019 Hello I'm a beginner with Phaser and I want to extended a physcis sprite. So this is my code. class Player extends Phaser.Physics.Arcade.Sprite { constructor (scene, x, y,texture) { super(scene, x, y,texture); } } var player1; var MyScene = new Phaser.Class({ Extends: Phaser.Scene, initialize: function MyScene (config) { Phaser.Scene.call(this, config) }, preload: function () { this.load.image('back', 'img/background.jpg'); this.load.image('dude', 'img/player.png'); }, create: function () { this.add.image(540,360, 'back'); player1 = new Player(this, 400, 100, 'dude'); this.add.existing(player1); } }); var config = { type: Phaser.AUTO, width: 1080, height: 720, physics: { default: 'arcade', arcade: { gravity: { y: 1000 }, debug: false } }, scene: MyScene }; var game = new Phaser.Game(config); The object display the sprite but the object don't fall and I can not set something in my class. I search a long time a long time on internet and I didn't found. Do someone know where is my mistake ? Link to comment Share on other sites More sharing options...
Recommended Posts