Difference between revisions of "Getting Started"
Danomatika (talk | contribs) (Added app usage notes for Mac OSX; added some subheadings to the Making a Game section) |
m (expanded dir to directory at "Applications dir") |
||
Line 64: | Line 64: | ||
===Mac OSX=== | ===Mac OSX=== | ||
− | On Mac OSX, a folder or .love file can be dropped onto the Love.app application bundle. On the Mac OSX Terminal (commandline), you can use love like this (assuming it's installed to the Applications | + | On Mac OSX, a folder or .love file can be dropped onto the Love.app application bundle. On the Mac OSX Terminal (commandline), you can use love like this (assuming it's installed to the Applications directory): |
<code>open -a love mygame</code> | <code>open -a love mygame</code> |
Revision as of 21:08, 17 May 2010
Get LÖVE
Download the latest version of LÖVE from http://love2d.org/download, and install it. If you're on Windows and don't want to install LÖVE, you can also just download the zipped binaries and extract them anywhere.
Running Games
LÖVE can load a game in two ways:
- From a folder.
- From a .love file (a renamed .zip-file).
In both cases, there must be a file called main.lua
on the root. This file will be loaded when LÖVE starts. If this file is missing, LÖVE will not recognize the folder or .love file as game, and you will be presented with the standard no-game screen.
On the command line, you can use love like this:
love mygame
For instance:
love /home/bob/mygame love /home/bob/packagedgame.love love C:\games\mygame love C:\games\packagedgame.love
You can inspect the version like this:
love --version
On Windows, there is a special option which will attach a console to the Window. This allows you to see standard output.
love --console
If you are running Windows and you want an easy way to play your applications, you can create a shortcut to the LÖVE executable in the folder above your LÖVE game. When you want to try the game, just drag and drop the folder to the shortcut, and it will run.
On Mac OSX, you can simple double-click a .love file to run it.
Making a Game
To make a minimal game, create a folder anywhere, and open up your favorite code editor. Notepad++ is a pretty good one for Windows, and it has Lua support built in. Create a new file in the folder you just created, and name it main.lua. Put the following code in the file, and save it.
function love.draw()
love.graphics.print("Hello World", 400, 300)
end
Windows
On Windows, the easiest way to run the game is to drag the folder onto love.exe, or a shortcut to love.exe. Remember to drag the folder containing main.lua
, and not main.lua
itself.
Linux
On Linux, you can use the command line. (Of course, you can use the command line in Windows too, if you prefer).
love /home/path/to/game
Mac OSX
On Mac OSX, a folder or .love file can be dropped onto the Love.app application bundle. On the Mac OSX Terminal (commandline), you can use love like this (assuming it's installed to the Applications directory):
open -a love mygame
In some cases it may be faster to invoke the love binary inside the application bundle directly via the following:
/Applications/love.app/Contents/MacOS/love mygame
You can setup an alias in your Terminal session to call the binary when you use love
by adding an alias to your ~/.bash_profile (open -a TextEdit ~/.bash_profile
):
# alias to love alias love="/Applications/love.app/Contents/MacOS/love"
Now you can call love from the commandline like Linux and Windows:
love /home/path/to/game