2D 地图创建
我是地图创建和数组存储的新手,想知道是否可以在这项任务中获得一些帮助。我正在使用 Java 工作并使用 LWJGL 库(如果这有任何帮助的话)。
我并不是想抄袭任何其他游戏,所以它会与其他游戏有所不同。我基本上只需要不同的区域,比如水、草和泥土。我最终会添加山脉、丘陵和攀岩等。
我需要知道如何实现这一点,如果可以的话,我对它很陌生,就像我说的,所以我没有任何代码可以给你任何知道我处于什么水平。
如果您能提供帮助,请留下答案,我也希望得到尽可能多的帮助。
I am new to Map Creation and array storing and was wondering if I could get some assistance in the task. I am working in Java and using the LWJGL library if that is any help at all.
I'm not trying to make a rip off of any other game, so it's going to be different from any other game. I will basically just need different areas, like water, grass and dirt. I'll eventually add mountains and hills and climbing etc.
I need to know how this can be achieved, if it can be, I'm new to it like I said so I don't have any code to give to give you any idea of what level I am at.
If you can help, please leave an answer, would love as much help as I can get too.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它的渲染方式(openGL、swing/awt、其他任何东西)与地图本身无关。这就是它的渲染方式。我使用了自己编写的一个特殊的 CooperativeMap 类,但它基本上只不过是
Map
的包装器。您想要的地图样式对您在此处尝试执行的操作有很大影响。我想大多数算法都会使用类似的东西(假设是矩形):
您可以做的另一个选择是传播。它的工作原理如下:
How it's rendered (openGL, swing/awt, anything else) isn't related to the map itself. That's just how it's rendered. I use a special CoordinateMap class that I wrote, but it's basically nothing more than a wrapper for
Map<Point,MapTile>
.How you want your map to be has a big impact on what you're trying to do here. I imagine most of the algorithms will use something like this (assuming rectangular):
Another option you can do is spreading. It works like this:
使用 Java 创建游戏的方法有多种。创建基于图块的关卡也可以通过多种方式完成。您可能想在互联网上搜索一些创建 2d java 游戏的教程,并找到一些关于如何执行此操作的想法。
既然你想用lwjgl,你会发现做基于2d的游戏很难。您还可以使用其他框架来简化此操作,此问题的答案将建议你一些。
以下是一些可能会激发您制作 2d 地图的链接:
您还应该尝试使用 游戏开发 stackexchange 站点。他们也可能会帮助您进行游戏编程。
There are several ways to create games in Java. Creating tile-based levels can also be done in several ways. You may want to do an internet search on some tutorials for creating 2d java games and find some ideas on how to do so.
Since you want to use lwjgl, you will find it difficult to do 2d-based games. There are other frameworks you could use that simplify this for you and the answers in this question will suggest you some.
Here are some links that may inspire you for making 2d maps:
You should also try to use the game development stackexchange site. They might help you with your game programming efforts as well.