I need to show an image on my first screen in phaser3 here is the code
//logo.js
class Logo extends Phaser.Scene{
constructor(){
super('Logo')
}
preload(){
this.load.image('gameLOGOFinal', './assets/gameLOGOFinal.png');
}
create(){
this.add.image(400,300, 'gameLOGOFinal');
setTimeout(() => {
this.scene.start('Start')
}, 20000)
}
}
the image is on the right path but it only show a green box
BTW I am using XAMPP apache to run it.
Are you sure that the image has been loaded? Open Dev tools in the browser > Network tab and see if the request with suffix 'assets\/gameLOGOFinal.png' has returned status OK. If not, see what request is being sent and what request you want to be sent.
"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.