Difference between revisions of "Love Game Engine"
(→Making a Game) |
(→Making a Game) |
||
Line 23: | Line 23: | ||
-- use to set up your game | -- use to set up your game | ||
end | end | ||
− | + | function love.update(dt) | |
+ | -- dt is the elapsed time since last call | ||
+ | end | ||
function love.draw() | function love.draw() | ||
love.graphics.print("Hello World", 400, 300) | love.graphics.print("Hello World", 400, 300) |
Revision as of 11:35, 3 June 2019
Download
Go to the main site for the Love engine:
Getting Started
The Love game engine uses Lua, so make sure you catch up and learn the language.
The link below is to the Lua wiki section, it covers all of the basics of Lua:
Making a Game
To make a minimal game:
- Create a folder for your game
- Open up your favorite text editor. Sublime Text is a pretty good one for all operating systems, 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 'main.lua' file, and save it:
function love.load()
-- use to set up your game
end
function love.update(dt)
-- dt is the elapsed time since last call
end
function love.draw()
love.graphics.print("Hello World", 400, 300)
end
You can obviously add more functions, classes, variables to make your own game. But the key sections are 'love.load()' and 'love.draw()'.
Running Games
Within Windows software such as ZeroBrane Studio, Sublime Text 2, Notepad++, and SciTE allow you to launch the game from within their code editors.
Otherwise, the easiest way to run the game is to drag the folder onto either love.exe or a shortcut to love.exe. Remember to drag the folder containing main.lua, and not main.lua itself.
You can create a shortcut to do this; simply make a shortcut to love.exe, right-click on it and select 'Send to Destop' to create a shortcut:
On Windows, there is a special command-line option which will attach a console to the window, allowing you to see the result of print calls. So right click your shortcut, choose 'properties', and edit the target to include '--console' eg:
"C:\Program Files\LOVE\love.exe" --console
Tutorials
Here is the link for the tutorial on the Love wiki site: