LÖVE is an unquestionably awesome 2D game framework, which allows rapid game development and prototyping in Lua.
After this short illustrated tutorial, you will be able to start programming games! The excellent Love2D engine is the tool here.
Posted by qubodup on Dec 9th, 2010
Basic Client Side Coding.
How does the computer convert source code to an interactive game? Let's find out!
Games consist of four main parts of code: load, update, draw and Events.
The load() function is used to open resources (images, sounds..) and give them names (variables).
update() runs after load() or draw() finishes. Calculations about game changes happen there - for example character movement.
dt measures the time it took to update() since the last time there was an update(). On an old computer, dt can be a big number (1 or even more) on a modern computer, it should be very small (at least 0.016 or less).
The draw() function is executed each time update() finishes. It is used for drawing shapes and images.
Events heppen when keys or mouse buttons are pressed or released or when the current window loses focus or is being closed by the "X"/"Close" button.
Let's make the keyboard move an image around on the screen!
The file/folder structure should look like this:
myGame/
|_
unit1.png
|_
main.lua
Write the following into the myGame/main.lua file:
love.load()
We will create a list for the images, create a unit and 'configure' it and set the background color.
love.update(dt)
On each update(), the unit's new position gets calculated.
The new position depends on dt, otherwise the movement would depend on the update() frequency (and thus on the computer speed).
love.draw()
All we do is draw the unit at its position. Background is re-drawn automatically in the beginning of draw().
Events (love.keypressed() and love.keyreleased())
Axis movement directions are set to 1, 0 or -1, according to what arrow key is pressed.
Well that's it! You can just download the code above in this file: main.lua.
You can either
This is what you should see:

This is it! You understand how the load-update-draw-events system works and are prepared to make some simple games! See you in my next tutorial!
great tut, i will have a go at this when i am free after my exams
great tutorial :)
any chance of getting another that deals with basic multiobject collision code(outside of box2d).
I needed something like this, thanks. :)
How can i change the window resolution? like "1280 x 800"