HTML5 画布碰撞检测
谁能帮我做一个我正在创建的小测试游戏。我创建这个游戏基本上是为了了解一些有关 HTML5 的知识,到目前为止一切都很好。我已经能够创建一个带有气球的画布,气球可以飞,当气球不飞时,它会落到底部。现在我希望气球能够停在另一个块图像上,我将其称为“level1”。如果有人可以看看它并查看源代码并建议我如何做到这一点,我将不胜感激。再次感谢。 :)
编辑:或者这可能不是创建关卡的最有效方法。如果不是,请说。 :)
Can anyone please help me out with a small test game I'm creating. I'm basically creating this game to learn a few things about HTML5 and so far it's all been good. I've been able to create a canvas with a air balloon that can fly and drops to the bottom when it's not. Now I want the air balloon to be able to stop on another block image, which I've called "level1". If someone could perhaps have a look at it and view the source and suggest how I would do this, I would appreciate it. Thanks again. :)
EDIT: Or perhaps this isn't the most efficient way to create a level. If it isn't then please say. :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如您对“着陆在底部”所做的那样,
您需要气球在到达关卡坐标时停止下落。我猜你的等级没有问题,你只需要将playerVelY设置为0即可。
As you did with "landing on the bottom"
you need the balloon to stop falling when it reaches the coordinates of the level. I guess there is nothing wrong with your level, you just have to set the playerVelY to 0.