移动器3:Update()帆布纹理不起作用
我正在尝试将此帖子转换为3: https://phaster.io/tutorials/codorials/coding -tips-002 但是update()函数不起作用。 在文件a.ts中,我创建了一个帆布纹理:
this.textures1 = this.textures.createCanvas('canvastextures1', 450, 170)
this.land1 = this.textures.get(MAPOPTIONS.BASE1_NAME).getSourceImage()
this.textures1.draw(0, 0, this.land1)
this.textures1.context.globalCompositeOperation = 'destination-out'
在文件b.ts中,在重叠()函数中:
this.activeTextures = this.textures.get('canvastextures1')
this.activeTextures.context.beginPath()
this.activeTextures.context.arc(Math.floor(overlap2.x-tile.getTopLeft().x), Math.floor(overlap2.y-tile.getTopLeft().y), 50, 0, Math.PI * 2, false)
this.activeTextures.context.fill()
this.activeTextures.update()
有人有任何想法吗?谢谢。
I am trying to convert this post to phaser 3: https://phaser.io/tutorials/coding-tips-002 but the update() function not working.I have also tried with refresh() function but it not working too.
In file a.ts I create a canvas texture:
this.textures1 = this.textures.createCanvas('canvastextures1', 450, 170)
this.land1 = this.textures.get(MAPOPTIONS.BASE1_NAME).getSourceImage()
this.textures1.draw(0, 0, this.land1)
this.textures1.context.globalCompositeOperation = 'destination-out'
and in file b.ts, in overlap() function:
this.activeTextures = this.textures.get('canvastextures1')
this.activeTextures.context.beginPath()
this.activeTextures.context.arc(Math.floor(overlap2.x-tile.getTopLeft().x), Math.floor(overlap2.y-tile.getTopLeft().y), 50, 0, Math.PI * 2, false)
this.activeTextures.context.fill()
this.activeTextures.update()
Does anyone have any ideas? Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 demo代码,它显示了我将如何接近整个
createCanvas
,地形/土地破坏碰撞机械师。除文件分配外,它应该涵盖所有要点。我希望这会有所帮助。
炸弹&火山口演示:
Here is a demo-code, that shows how I would approach the whole
createCanvas
, terrain/land destruction collision mechanic.It should cover all the points, except the file splitting. I hope this helps.
Bomb & Crater Demo: