EnderSpirit Posted October 21, 2018 Share Posted October 21, 2018 Hello, I'm new to Phaser 3, I know how to create sprites from images, but how can I create a sprite from graphics ? I tried the following way and a lots of things, but I don't figure out how to do that. That's creating a sprite, but it's invisble. What I am doing wrong ? class MainScene extends Phaser.Scene { // ... create () { this.physics.world.setBounds(this.BOUND_X, this.BOUND_Y, this.BOUND_WIDTH, this.BOUND_HEIGHT); this.cameras.main .setBounds(this.BOUND_X, this.BOUND_Y, this.BOUND_WIDTH, this.BOUND_HEIGHT); var graphics = this.add.graphics().fillStyle(0xff00ff).fillRect(1500, 1500, 400, 400); graphics.generateTexture('box', 400, 400); this.sprite = this.physics.add.sprite(200, 200, 'box').setCollideWorldBounds(true); // ... } // ... Thanks ! Link to comment Share on other sites More sharing options...
Recommended Posts