如何在Java Gui的迷宫游戏中暗示墙壁
我的小迷宫游戏中有一个带有墙壁的图像,但是目前,我的玩家可以在墙壁上自由地四处走动。如果我想将这种自由移动限制在墙壁上,我是否必须一个一个一个一个一个一个一个矩形并正确对齐,以使它们与我的图像中的墙壁匹配,如果我的玩家撞到了一堵墙,我必须做碰撞检测检查?还是我需要制作一个墙类,并使用可以检查它们是否与玩家接触的方法创建墙壁对象可以限制运动?我将如何继续实现这一目标?
I have an image with walls in it for my little maze game but currently, my player can move around freely meaning on top of the walls. If I want to restrict this free movement with walls, do I have to paint multiple rectangles one by one and align them properly so that they match the walls in my image, and if my player is hitting a certain wall, I would have to make a collision detection check? Or would I need to make a Wall class and create wall objects with methods which can check if they are in contact with the player, can restrict the movement? How would I go on about achieving this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论