LÖVE is a framework, independent of Codea, that can be used to make 2D games in Lua (currently, version 5.1). The framework is free and open-source (licensed under the zlib/libpng licence). It works on OS X, Windows and Linux systems.
loveCodea and loveCodify
loveCodea.lua is a wrapper that enables LÖVE to run Codea code, to the extent that the functionality of LÖVE and Codea overlaps and the emulation of that functionality has been implemented. The implementation of loveCodea.lua is not complete.
loveCodea.lua builds on loveCodify, the work of Florian^SiENcE^schattenkind.net, first released on GitHub in November 2011. loveCodify is licensed under the MIT licence. loveCodify is intended to work with version 0.7.2 of LÖVE.
Between April and May 2012, loveCodify was updated and extended by Stephan Effelsberg as loveCodea, and it has been further updated since then. loveCodea is intended to work with version 0.8.0 of LÖVE.
Using loveCodea.lua with LÖVE
LÖVE runs a game from either a folder or a
.love file. The following guidance assumes that your Codea code is being run from a folder.
If the folder contains a file named
conf.lua, then LÖVE runs it before other modules are loaded. The LÖVE 'boot' script later calls a function
t is a table of default configuration values.
conf.lua can be used to overwrite the
love.conf(t) function to set other configuation values.
The folder must contain a
main.lua file, which is loaded when LÖVE starts.
To use your Codea code with LÖVE and loveCodea, follow these steps:
1. Create a folder on your Mac or PC for your Codea code.
2. Put a copy of your Codea code in the folder, in the form of one or more
.lua files. One of those files should be named
3. Put a copy of the
loveCodea.lua file (here) in the same folder.
4. The file
main.lua should start with the following code:
if require ~= nil then require("loveCodea") require(" ... extra Lua files ... ") require(" ... of your project ... ") end
require(modname) statement is required for each
.lua file in the folder. Lua's
require() function is disabled by Codea by setting
require = nil. By wrapping the
require(modname) statements in the
if ... then ... end block, the same code can be used in Codea without editing.
loveCodea uses global variable
LOVECODEAHUD to determine whether it should draw a head-up display (HUD).
LOVECODEAHUD = true by default. To turn off the HUD, add a
LOVECODEAHUD = false statement to
5. Create a
conf.lua file in the folder with code to overwrite the
love.conf(t) function to modify the default configuration for screen width and height, as follows:
function love.conf(t) t.screen.width = 1024 -- 750, if displayMode(STANDARD) t.screen.height = 786 end
For Windows systems only, if you wish LÖVE's console window to be visible set the following key of table
t.console = true -- Attach a console (boolean, Windows only) (default is "false")
You may also wish to set the following other keys of table
t.title = "Untitled" -- The title of the window the game is in (string) t.author = "Unnamed" -- The author of the game (string)
6. If your Codea project uses a sprite from a sprite pack, create a folder in the project folder with the name of the spite pack in question. Copy the
.png file for the sprite, with the name of the sprite in question, into the relevant sprite pack folder.
7. Run LÖVE with your folder.
Touch events are emulated by clicks of the left mouse button. Gravity is emulated by using the up, down, left and right arrows keys on the keyboard to increase or decrease gravity.