Game Development Reference
In-Depth Information
Lua scripts are text files, so naturally they're easier to edit than property lists, regard-
less of whether you're using a property list editor or editing the property list XML file
directly. And Lua scripts allow you to comment on each line to explain your rationale,
the range of valid values, and so on. You can't do that with property list files because
property list editors don't allow you to comment on entries.
Note Lua support for Kobold2D was originally provided by the Wax library
created by Corey Johnson. Wax allows all Lua scripts to call any Objective-C
method and to instantiate Objective-C classes, including cocos2d classes.
However, Kobold2D avoids Wax scripting, and eventually most of the Wax
project was removed. Instead, Kobold2D uses Lua only to load settings files
like config.lua , executing Lua scripts and calling Lua functions. This is
fast. For actual game scripting with Lua, the add-on product KoboldScript is
currently in development. You can get more info about KoboldScript on .
The config.lua file contains settings for just about everything you might want to
tweak during the start-up process. Listing 16-1 shows an example config.lua file.
Listing 16-1 . The config.lua Script Contains All Start-up Settings for Kobold2D
local config =
KKStartupConfig =
-- load first scene from a CCScene or CCLayer derived class with this name
FirstSceneClassName = "HelloWorldLayer",
MaxFrameRate = 60,
DisplayFPS = YES,
EnableUserInteraction = YES,
EnableMultiTouch = NO,
-- Render settings
DefaultTexturePixelFormat = TexturePixelFormat.RGBA8888,
GLViewColorFormat = GLViewColorFormat.RGB565,
Search Nedrilad ::

Custom Search