Load a level from text file – No Plugins

Here’s an example of loading a level stored as a text file into an array with no external plugins.  Created for a user on the forums the example is a bit “hacky” but I created it to show that this sort of thing can be done without the need of external plugins.  The example also shows saving the array to JSON and then in layout 2 loading the JSON into a different array.

The level is stored as below in the text file:

0000000000
0124122320
0155482210
0565322660
0124458650
0565956560
0854856220
0545269550
0154852320
0000000000

DOWNLOAD

Quick note that this example only works with single digits to represent level data.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s