edit solved by myself: I didn’t add physics
key to my config object! Shame on me.
Hello.
I’m new to Phaser and I try to implement a sprite shooting towards pointer. I have multiple scenes (title and game) and I don’t know how can I add arcade physics to the certain object in my scene.
class GameScene extends Phaser.Scene {
constructor() {
super({key: 'gameScene'});
this.sprite;
}
preload() {
this.cameras.main.setBackgroundColor('#c0c0c0')
this.load.image('player', 'assets/player_placeholder.png');
}
create() {
this.sprite = this.physics.add.sprite(360, 420, 'player');
}
}
export default GameScene;
The line this.sprite = this.physics.add.sprite(360, 420, 'player');
does not work and to be honest I don’t know if it should. I have found many tutorials for physics but not even single one based on scenes
What is correct way to add physics to my sprite?
I’m sorry if my question is trivial. I have spent two hours searching an answer ;c