Hopefully you found a suitable Text Editor for your system. For the duration of this tutorial series I will use Fraise on Mac OS X and Notepad++ on windows. If you want to know more about Text Editors see my post about editors on Mac OS X and the other post about editors on windows.
1. Open your Texteditor, make a new file. Save it as main.lua in a directory called “tut0″. Main.lua will always be the first file that is executed/interpreted by love.
2. Type the following:
Drag the directory “tut0″ on the love.app or love.exe. This should be your result:
Tip: To speed things up in the future you can also use the terminal on Mac OS X:
- Open the Terminal
- Type: alias love=’/Applications/love.app/Contents/MacOS/love’
- Click on ‘Shell’ in the menubar, and then ‘Use Setting as Default’
- You can now just type: love pathtodirectory, where pathtodirectory is your current project folder , e.g. /Users/me/love/tut0
On windows and especially with Notepad++ you can set up a keycombination that launches your current project. See the tutorial on windows editors on how to set that up.
Making a .love file
The great thing about .love files are that they launch directly with love(if love is properly installed on your system) and they are easily distributable. As I said .love files are basically renamed .zip files. So easiest steps to a .love file would be:
- Go INTO your current project folder.
- Select all the files and subfolders add them to a .zip file, for example to tut0.zip
- Rename the tut0.zip file to tut0.love, in the Mac OS X terminal this would be the command: mv tut0.zip tut0.love
- If you double click the resulting file it should be executed
The first step is very important. A common problem for beginners is that they put the whole folder in the .zip file. This will not work. The main.lua has to be in the root of the zip file!
In the next part of this series we will actually begin programming a game!Love2d – What is Love? An Introduction Love2d – Introduction: Installing/Choose a Texteditor on Windows Love2d – Introduction: Installing/Choose Texteditor on OS X Love2d – Tutorial Part 0 | Hello Wörld Love2d – Tutorial Part 1 | Invaders must die! Love2d – Tutorial Part 2 | Pew Pew!