[英]Image in Phaser3 is not showing
I need to show an image on my first screen in phaser3 here is the code我需要在 Phaser3 的第一个屏幕上显示图像这是代码
//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.顺便说一句,我正在使用 XAMPP apache 来运行它。
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.
在浏览器中打开开发工具 > 网络选项卡,查看后缀为“assets\/gameLOGOFinal.png”的请求是否返回了 OK 状态。 If not, see what request is being sent and what request you want to be sent.
如果没有,请查看正在发送什么请求以及您希望发送什么请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.