问题标签 [tiled]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
318 浏览

c++ - Add a tiled base map to a GraphicsScene

I try to create a tiled base map by using Qt GUI: I have two classes: one to set my tile images that inherits from QGraphicPixmapItem, one to load my map from a text file that is a 2D array composed of the numbers 1, 0 and 2, and add it to a scene: But my program quits unexpectedly and I do not know where is the break:

my tile class:

my class map:

Map.h:

And Map.cpp

and finally my mainwindow (I directly give the file.cpp):

Sorry guys for the long post but I am stuck! Any ideas on what I missed?

0 投票
0 回答
97 浏览

ios - 如何在 cocos2d-iphone v3 中制作位置固定的精灵?

如何在 cocos2d-iphone v3 中制作一个位置固定的精灵?我尝试制作另一个 CCNode,并添加到它,但它仍然与整个瓦片地图一起滚动。

编辑:这是我的代码

0 投票
0 回答
152 浏览

cocos2d-iphone - 修复了瓷砖地图 cocos2d 上的精灵?

我不知道如何处理瓦片地图图层和其他节点。当整个地图滚动时,我想为菜单按钮、得分、操纵杆等内容制作另一个图层(CCNode),这些图层必须始终保持固定(不滚动)。

现在upArrow在屏幕上根本不可见。如果我添加 toself而不是joystickNode,它将出现。

我什至无法理解,新的 CCNode 应该有什么父级。谁能给我解释一下?我还尝试将新的 CCNode 添加为selfand的子级theMap

编辑:哎呀,它实际上是在移动相机。在这种情况下如何实施?

0 投票
0 回答
79 浏览

ios - CCSprite 着色器程序留下 1px 透明边框

我正在开发一个游戏,玩家可以在使用平铺地图编辑器创建的等距地图周围拖放CCSprites 。

为了允许自动 vertexZ 重新排序,我depthTest[CCDirector sharedDirector]我的AppDelegate.

每当更新CCSpritesposition时,我都会调用此函数

正确地重新排序精灵。

每当实例化这样的精灵时,我设置shaderProgram如下:

现在,当两个精灵像这样对齐时(x 是精灵,0 是空的):

并从等轴测角度观察。它们确实放置正确。然而,沿着第一个(最近的)精灵,一个 1px 的边框是可见的 - 见图片。这是背景中的地板——不是很酷。

在此处输入图像描述

为什么这个边框是可见的,我怎样才能摆脱它?

0 投票
1 回答
194 浏览

andengine - Tiled 中的 TMX 地图与 Andengine 中加载的地图不匹配

我正在 Tiled 中创建自己的 TMX 地图。我已经导入了一些 Patterns Set 并将它们设置在相应的 Tile Layer 中。地图在 Tiled 中看起来不错,但是当我使用 Andengine 在我的关卡中加载它时,每个图块中显示的图像与我在 Tiled 编辑器中使用的图像不同(显示矩阵中的另一个图块,而不是我在编辑)

使用它加载的代码是正常的:

我不知道这是否重要,但瓷砖是 70x70,加载它们时我必须包含 2px 的间距。问题是我从作品中完美地提取了这个例子,但是那里的瓷砖是 32x32 并且没有间距。压缩是gzip,路径是正确的。太感谢了!

0 投票
1 回答
477 浏览

phaser-framework - 如何从 Tiled 中导出与 Phaser 中的“createObjectsFrom”兼容的瓦片地图?

函数createFromObjects 具有gid作为要传递的第二个参数。该参数createFromObjects以下列方式在函数中使用:

这期望层中的对象包含指向要使用的精灵name的字段。gidgid

但是,从 Tiled 导出的 JSON 文件不包含任何字段gid

平铺仅允许向对象添加自定义属性,并且对象上没有gid要编辑的字段。

如何gid在导出的 JSON 中包含一个?

0 投票
2 回答
3707 浏览

java - LibGDX: How to get the same coordinates in tiled map for tile with and without zoom

I am a beginner with LibGDX. I am trying to create an android game based fixed size tiled map (33x21 tiles). Tiles I am using are 32x32px. So far I managed to load the map created with Tiled and add touch gestures like zoom in/out and panning. The game character movement will be turn based tile by tile, so I need to have a possibility to select specific tile in order to perform some action. I tried solution from here: LibGDX: How to make tiled map tiles clickable? and it works perfectly fine, until the screen is not zoomed in.

Without zoom, the left-bottom corner coordinates shows that it is (0,0), which is correct. When I zoom in, the left-bottom corner of the visible part of the map instead of keeping it's correct coordinates (i.e. (480, 320)) it becomes (0,0) again. I tried to use camera.unproject(Vector3), but I was unsuccessful. Probably used it wrong. I am also not really convinced, that the way in which I try to get tiles is the most appropriate one. Can you help me get tiles coordinates properly? Below is the code that I am using:

}

0 投票
1 回答
455 浏览

java - 如何从 *.tmx 文件中读取折线?

我正在使用 TmxMapLoader,但似乎找不到从 *.tmx 读取折线数据的方法。

*.tmx 文件的相关部分:

我检查了 TmxMapLoader 的代码,似乎它实现了这个功能,但我找不到获得它的方法。

有任何想法吗?

0 投票
1 回答
2079 浏览

javascript - 基于六边形网格的html5/canvas游戏框架

我正在开发基于六边形网格的 html5 游戏。

经过一番调查,我使用过:

MelonJS + Tiled +这个棘手的事情。在这个组合中一切似乎都很好,直到我开始考虑动态显示一些六边形,我的玩家将能够去。有几个想法浮现在脑海:

  • 计算坐标并在画布上绘制跳过 melonjs,但从架构的角度来看这是个坏主意。

  • 为每个六边形纹理对象添加自定义属性,但是手动操作太多。

  • 为 melonjs 添加一些外观以便使用它,或者它可能已经完成?

所以我的问题是:

在这些技术范围内解决这个问题的最佳方法是什么,或者我应该使用其他工具?

0 投票
1 回答
450 浏览

java - 突出显示具有透明度的图块

我正在根据平铺地图制定基于回合的策略。我的地图包含两层 - 第一个始终可见并用作背景,第二个用于突出显示图块。突出显示的图块显示玩家可能的移动。目前进展如下:

我的边框图片

为了使突出显示成为可能,我使用了这个 for 循环:

for(int s = 0;s<7;){ for (int i = 0;i<7;i++) { if ((inField(clickx + i,clicky + s)) && !(tileWithPlayer(clickx + i,clicky + s))) { highlight_layer.getCell(clickx + i, clicky+s).setTile(mark); } } s++; }

在此,我使用地图第二层的一个图块为特定图块制作边框。现在这个图块只是 32x32 透明图块的 2px 边框。为了使突出显示消失,我使用了类似的 for 循环,我将 tile 设置为 null。选择/取消选择瓷砖效果很好,但这可能不是最有效的方法。我想将蓝色边框框换成彩色透明框,就像在移动期间的高级战争中一样,或者如下所示:

想要的样子图片

我试图在平铺的第二层上制作一个半透明的瓷砖,但没有运气。如果有可能在特定图块上仅应用半透明颜色而不使用第二层图块,那就太好了。所以,我的问题是 - 我怎样才能将那些丑陋的边框换成全彩色的(半)透明瓷砖,以达到与上图相似的结果?