Loading XML Map Data with Array Storage

Show us your completed creations made in Construct 2

Post » Sun Jul 22, 2012 1:17 pm

This is the first time I've shared anything. This example utilizes Ajax, XML, and 8Direction.

The script I'm about to share [r98] consists of loading an XML file loaded with mapping data. In this specific example, nodes with 'W' represent a wall. Once the XML file loads via AJAX it stores the nodes in an array.

Screenshot Map Editor

As you can see in this screenshot. The W represents the walls. H represents hollow spaces. S represents where the 8Direction will start.

http://dl.dropbox.com/u/53052693/mapping%20Array.capx


The main loop destroys every wall block every tick. Then tests the X and Y limits of the viewport based off the scrollx and scrolly, and window height and width. If the conditions are met, the wall block is rendered. Otherwise it is ignored.

The overall size of this map (XML) is 50x50 nodes. Thats 2500 array index. With 32px tiles, this comes out to a 1600x1600 px map. Since performance degrades sharply at 1000 objects (if not before), rendering 2500 objects is a big no-no. This script allows you to only render what is needed.

Enjoy.digitalsmeg2012-07-22 13:19:06
B
12
G
1
Posts: 19
Reputation: 1,066

Post » Sun Jul 22, 2012 1:34 pm

Thanks for sharing this
B
19
S
6
G
7
Posts: 1,203
Reputation: 7,294

Post » Sun Jul 14, 2013 7:17 pm

can you repost that please got a dead link?
B
20
S
3
Posts: 109
Reputation: 1,967

Post » Sun Nov 17, 2013 1:45 pm

link works nowdigitalsmeg2013-11-17 13:47:00
B
12
G
1
Posts: 19
Reputation: 1,066


Return to Completed Creations

Who is online

Users browsing this forum: No registered users and 2 guests