【发布时间】:2022-01-09 02:55:53
【问题描述】:
我正在尝试在 Phaser 的预加载功能之外将基本图像加载到我的 Phaser3 游戏中,但没有任何效果。
我试过了:
- 我的 utils.js 中的延迟加载功能:
dynImgLoader(textureKey,x,y,asset)
{
let loader = new Phaser.Loader.LoaderPlugin(this.scene);
loader.image(textureKey,asset);
loader.once(Phaser.Loader.Events.COMPLETE, ()=>
{
console.log('sprite ready for usage');
})
loader.start();
}
调用时它仍然给我默认的移相器资产图像(未加载)
- 我尝试了 tutorial 在 index.js 中的 create 函数中告诉我的内容:
this.load.image('arc_red', arc_red);
this.load.onLoadComplete.add(this);
this.load.start();
还是不行。
问题:
如何在不使用预加载功能的情况下为多人网络套接字游戏“动态”加载资源?为什么我做错了?
【问题讨论】:
标签: javascript node.js image canvas phaser-framework