Friday, July 26, 2019

Create 2D games in LUA and LÖVE framework


LUA is a powerful, efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description.
The best of all, it's open-source and free.

With LUA, you mark blocks of code using the syntax do and end, instead of using braces. It has about 20 reserved keywords.

image source: Admin Magazine


With LUA and the LÖVE framework, you can create some cool 2D Games.
The LÖVE framework is very simple. Just check out these code snippets:

Drawing text

function love.draw()
love.graphics.print("Hello World!", 400, 300)
end


Drawing an image

function love.load()
whale = love.graphics.newImage("whale.png")
end

function love.draw()
love.graphics.draw(whale, 300, 200)
end


Playing a sound

function love.load()
sound = love.audio.newSource("music.ogg", "stream")
love.audio.play(sound)
end


More tutorials can be found in the LÖVE wiki.