我应该用什么来进行碰撞测试呢?
我正在开发一个游戏。我可能需要做一些数学运算。我有一个由大约 5-6 个位图组合而成的角色。我想检查它的碰撞。例如,如果他击中子弹,击中平台等等。我还想检查是否按下了位图(如按钮)。我听说 rect 对此很有用,但我不知道如何使用它。任何人都可以解释如何使用 rect 来实现它,或者您是否有更好或更简单的想法。 谢谢!
I am developing a game. I would probably need to do some math in it. I have a character made out of about 5-6 bitmaps together. I want to check its collisions. For example if he hits a bullet, hit platform and all of this stuff. I also want to check if a bitmap is being pressed(like a button). I heard that a rect is good for this but I'm not sure how to use it. can anyone explain how to use the rect for it or if you have a better or easier idea.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看在 Adroid 中使用图形系列文章。 第 7 部分。
Checkout the Playing with graphics in Adroid series of articles. Collision detection is covered specifically in part 7.
没关系,我发现 rect 类有 contains 选项。
例如:
Never mind, i found out that the rect class has contains option.
for example: