[GUIDE] How to make CoronaViewer work with LevelHelper

As Gremlin Interactive pointed out in his very useful post there can be no folders with upper case characters in the project, otherwise the syncing via the Dropbox just won’t work.

For our game “Freeze!” and the sequel we are just working on we heavily depend on the tools LevelHelper & SpriteHelper to create the animations, spritesheets and levels: http://www.gamedevhelper.com 

But unfortunately LevelHelper creates its on folder in the project, named “LevelHelper”, and some subfolders “CustomClasses”, “Nodes” and “Helpers”.

In the Lua code that is generated by the tool (LevelHelper creates lots of code e.g. for animations and parallax scrolling, collision handling, etc.) of course all these folders are called with the upper case characters.

And:

If you add e.g. new custom classes or collision tags in LevelHelper, the code is generated again. So if you changed all the folders and references in the Lua files manually you have to do it again every time.

But there is a simple solution:

In your main.lua use

[lua]

require “levelhelper.LevelHelperLoader”

[/lua]

instead of

[lua]

require “LevelHelper.LevelHelperLoader”

[/lua]

And in your config.lua use lower case subfolders:

[lua]

LevelHelperSettings = 

{

     imagesSubfolder = “images”,

     levelsSubfolder = “levels”,

}

[/lua]

Now after the Lua code was generated the first time and every time you had to generate the Lua code again just use this simple Apple script:

[lua]

set theFolder to choose folder

 

tell application “TextWrangler”

activate

open find multiple window

replace"LevelHelper.CustomClasses." using “levelhelper.customclasses.” saving yes searching in theFolder options {search mode:literal, case sensitive:true, match words:false, extend selection:false, showing results:true}

close search results browser 1 saving no

close find multiple window saving no

end tell

 

tell application “TextWrangler”

activate

open find multiple window

replace"LevelHelper.Helpers." using “levelhelper.helpers.” saving yes searching in theFolder options {search mode:literal, case sensitive:true, match words:false, extend selection:false, showing results:true}

close search results browser 1 saving no

close find multiple window saving no

end tell

 

tell application “TextWrangler”

activate

open find multiple window

replace"LevelHelper.Nodes." using “levelhelper.nodes.” saving yes searching in theFolder options {search mode:literal, case sensitive:true, match words:false, extend selection:false, showing results:true}

close search results browser 1 saving no

close find multiple window saving no

end tell

 

tell application “Finder” to set name of theFolder to"levelhelper"

tell application “Finder” to set name of folder “CustomClasses” of theFolder to"customclasses"

tell application “Finder” to set name of folder “Helpers” of theFolder to"helpers"

tell application “Finder” to set name of folder “Nodes” of theFolder to"nodes"

[/lua]

Save this script as “LevelHelperFix.scpt” and start it. It will ask for the location of the “LevelHelper” folder and than change all folder names and references in the code to lower case, so everything will now work with CoronaViewer.

Oh, and you need to have the free text editor “TextWrangler” installed, I use it to find & replace text in multiple files (and Walter likes it, too :D ):

http://www.barebones.com/products/textwrangler/download.html 

I additionally attached the zipped script file.

It now works like a charm and I use this for fast testing on the device while creating new levels (because of the touch controls of the game where you rotate the levels using your finger it is essential to test all levels on the device).

And additionally we use this for playtesting, all team members and playtesters have the CoronaViewer app on their devices and they have instant access to new levels, features & fixes.

Thanks for this cool feature!

Best,

Andreas