Kaoff Posted November 26, 2018 Share Posted November 26, 2018 Hello there ! I'm just starting with Phaser 3, and I was hoping to make myself a simple pong game as an exercise to test out the framework. Thus, I wish I could only use the this.add.rectangle method in my scene to display my players and my ball, but this method only work when I already invoked the this.add.image method BEFORE. To be more explicit: export default class PlayScene extends Scene { constructor () { super({ key: 'PlayScene' }) } create () { const logo = this.add.image(400, 150, 'logo') const rect = this.add.rectangle(400, 300, 100, 100, 0xff0000, 1) this.tweens.add({ targets: logo, y: 450, duration: 2000, ease: 'Power2', yoyo: true, loop: -1 }) } } This will display both logo and rectangle But export default class PlayScene extends Scene { constructor () { super({ key: 'PlayScene' }) } create () { const rect = this.add.rectangle(400, 300, 100, 100, 0xff0000, 1) } } This will display nothing. Is it normal ? Might the fact I am using PhaserCLI be the problem ? Thanks for your answers :) Link to comment Share on other sites More sharing options...
rich Posted November 26, 2018 Share Posted November 26, 2018 This is a known bug in 3.15.1, already fixed in 3.16 beta in the master branch. You don't have to add an image, you could also put a stroke on the rectangle (with alpha zero) and it'll work too. Kaoff 1 Link to comment Share on other sites More sharing options...
Recommended Posts