[plugin] rex_tmx_importer_v2

Post your completed addons to share with the community

Post » Wed Sep 17, 2014 4:39 pm

New version of the Tiled Maps editor...

http://www.mapeditor.org/download.html
Sebastian Dieguez
http://about.me/sebasoft
B
7
S
1
G
1
Posts: 9
Reputation: 783

Post » Wed Oct 01, 2014 2:48 pm

I have one problem with spawning ground segments for my endless runner game. I'm writing this here, because I don't know if it's plugin dependent (I don't think so) or just general Construct 2 knowledge.

I want to spawn segment after segment like this so there won't be any gaps between segments. The problem I have is how to figure out what to use as a delay between spawning of previous and the next segment? Firstly I used just Every time, but I noticed that it's framerate dependnt. On iPad mini, iPhone5 and PC there is no gaps. Everything is spawned very nice, but on iPad 2 or even on PC in debug mode time-steps are different and gaps are created.

I tried doing it many, many ways and none is working. I tried on distance, my last try is on the project I upload and it's based on when first ground-object's X is <32. But it's also faulty. As you se I tried to somehow change this property of 32 based on dt, but I don't know if it's even a right way and if it is I don't know how to set it correctly. You can see it in:
spawningGroundLevelsTiled.capx


Another .capx (
spawningGroundLevelsTest.capx
) I upload is another implementation of this problem, not using Tiled. This one is working perfectly, but I don't know how to implement it using Tiled...
You do not have the required permissions to view the files attached to this post.
Member of PLUS(S). Check out our games at: http://pluss.newgrounds.com/
B
8
S
1
G
1
Posts: 23
Reputation: 838

Post » Thu Oct 02, 2014 8:26 am

@samur

I am not sure what you want.
In capx, you use retrieve tile array under "1 tick mode". It will trigger all things in a tick.
If it breaks the performance, you might try "retrieve tile array in a duration".
B
108
S
26
G
258
Posts: 4,430
Reputation: 145,179

Post » Thu Oct 02, 2014 11:43 pm

@rexrainbow

Is it possible to manipulate the tiles at runtime? For example

If player touches "lava" tile -> damage player?
B
82
S
39
G
15
Posts: 982
Reputation: 16,712

Post » Fri Oct 03, 2014 4:01 am

@justifun

Since each tile is an instance , you could
+ on touch tile
- do something
B
108
S
26
G
258
Posts: 4,430
Reputation: 145,179

Post » Fri Oct 03, 2014 8:47 am

@rexrainbow Let me explain it more clearly. I'm trying to create three indefinite levels of ground for endless runner game. I'm creating this ground from segments. Each segment has the same width and I create each segment in Tiled. So my segments is something like this:
_ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _

And your importer works great spawning one segment like this. Now what I want to do is to spawn another segment while previous one is already on the board so they will connect together without any gaps (empty spaces) between them. But because of low FPS my implementations for this are framerate dependent and when I don't have any gaps on my PC, I have them on debug mode or on iPad. Maybe some of you would have some solution for this. Right now I'm thinking to somehow glue them manually by picking last tile of previous segment and translating tiles of the new segment so they will stick together...
Member of PLUS(S). Check out our games at: http://pluss.newgrounds.com/
B
8
S
1
G
1
Posts: 23
Reputation: 838

Post » Sat Oct 04, 2014 7:11 am

@samur

I have no idea. Maybe check the position of origin point. Or....
B
108
S
26
G
258
Posts: 4,430
Reputation: 145,179

Post » Tue Oct 14, 2014 6:49 am

@rexrainbow - it appears that the json file that tiled is creating doesn't work with the v2 json importer anymore.

I notice that compared to your example file, all attributes in your json example data have 2 "" around them, where as tiled only puts 1 around each one. eg: "height" etc

If i manually replace all " with "" and try and load that, it accepts it, but when you run the example it gives a javascript error in chrome saying "cannot find "tile layer 1"

Tiled map Editor 0.10.1
Construct r183
Json TMX parser
TMX importer v2
Rexrainbow's sample capx for the importer

steps to reproduce -
1) In tiled map editor goto file save as "type json"
2) try to copy json file into example capx -> multiple errors complaining about only 1 " around attributes in json
3) tried replacing all " with "" and pasted into example capx. C2 accepts it, but gives javascript errors when running a preview.

perhaps the plugin just needs to be updated to work with the latest version of tiled?
B
82
S
39
G
15
Posts: 982
Reputation: 16,712

Post » Tue Oct 14, 2014 7:26 am

@justifun

If user want to put " into expression, it need to replace " to "".
Another solution is load string from external text by official AJAX plugin, so that the source string does not need to be changed.
B
108
S
26
G
258
Posts: 4,430
Reputation: 145,179

Post » Tue Oct 14, 2014 4:26 pm

@rexrainbow

Ok i tried loading the json file as an imported project file using the ajax "request tiles.json" command

then Ajax on "tiles" completed - importing the ajax.lastdata into tmximporter v2

but i get the following javascript error during preview.

TMX Importer: Can Not Find "Tiles" Layer

which is the name of my layer in tiled.

Do i need to specify that name somewhere in my event code? or rename my file or something?

Here is my modified sample capx.
https://db.tt/RYnwCGsU
thanks for the help.
B
82
S
39
G
15
Posts: 982
Reputation: 16,712

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 0 guests