[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: does anyone know of a lua 2D game focused tutorial
- From: Dirk Laurie <dirk.laurie@...>
- Date: Thu, 10 Nov 2011 19:38:39 +0200
2011/11/10 kingsley young <email@example.com>:
> Yes I know of love2d but the wiki is how to make a game in love like( tables
> and functions ) not how to make a game I need the fundamentals the building
> blocks. The tutorials from start to end that's what I'm looking for
A minimal Löve game has one file called "main.lua".
Basic structure of what happens in a Löve game:
1. Do some initialization
2. Keep drawing things on the screen
This basic structure is interrupted all the time by the ticking of the
clock and by what the player is doing: moving the mouse, pressing and
releasing mouse buttons and keys on the keyboard. Whenever that
happens, your program gets an opportunity to change something.
That gives nine routines that just about every game must have,
described in the "callbacks" part of the tutorial.
It's the only must-read part of the tutorial.
Once you've got that far, stop reading the tutorials. Just experiment
with what you put inside those nine routines. You can get quite far
doing that. When you get to thinking of an effect you would like to
put in (sounds etc) go look for that effect. Chances are Löve has it.
To get you started, I've appended an extremely simple "game" that has
a ticking clock, displays mouse press and release coordinates and
changes colors on keyboard press and release. Note the basic
principle: the other routines do all the calculations, the draw
routine just draws.
To run this game, unzip it and copy the font file comicbd.ttf (in
the unlikely event that it's not on your computer, google for it
and download it) to the same directory. Now call Löve giving it
the name of that directory. Or you can re-zip the two files and
give Löve the zipfile.
Description: Zip archive