Reading XML tile editor info

Get help using Construct 2

Post » Fri Apr 20, 2012 9:19 pm

I was trying to use Ogmo to make levels in XML and import them on C2. But i'm not sure how to read it...

This an example of the XML it creates:

<level>
<NewLayer0 exportMode="Bitstring">
0000000000000000000000000000000000000000
0000000000011110000000000000000000000000
0000000000111110000000000000000000000000
0000000000101000000000000000000000000000
0000000001101000000110000000000000000000
0000000000101100111111111000000000000000
0000000111101110100001000000000000000000
0000000100000110100001000000000000000000
</NewLayer0>
</level>

I can load the file, but I don't know which XPath string I need to read this. Can I convert this information to an array?7Soul2012-04-20 22:38:55
B
83
S
21
G
15
Posts: 1,039
Reputation: 15,134

Post » Fri Apr 20, 2012 9:35 pm

assuming you read the entire string inside the tags youd have to split it at linebreaks and 0s and 1s to get it in an array the hardest part after that would be makin sure it gets in the array in the right order after the splits
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Fri Apr 20, 2012 10:33 pm

I've managed to take a string of ones and zeroes and put them on an array, then I output the array values to a Text, just to check if it worked, and the text displays the ones and zeroes as expected. But when I check for numbers 1 in the array, it never returns true
Here's a screen and the capx:
(the string value doesn't show up in the editor cuz it's too long, but its there)


http://dl.dropbox.com/u/3954039/auto-tiling.capx
B
83
S
21
G
15
Posts: 1,039
Reputation: 15,134

Post » Sat Apr 21, 2012 10:14 am

[QUOTE=7Soul] I've managed to take a string of ones and zeroes and put them on an array, then I output the array values to a Text, just to check if it worked, and the text displays the ones and zeroes as expected. But when I check for numbers 1 in the array, it never returns true
Here's a screen and the capx:
(the string value doesn't show up in the editor cuz it's too long, but its there)


http://dl.dropbox.com/u/3954039/auto-tiling.capx[/QUOTE]

The returned value is a string try "1"!
B
21
S
7
G
2
Posts: 185
Reputation: 3,280

Post » Sat Apr 21, 2012 4:10 pm

@00Rez duuuuude, I love you! Thx :D
B
83
S
21
G
15
Posts: 1,039
Reputation: 15,134


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests