love2d luajit code example

Example 1: love2d

Love2D is a Lua based engine with a lot of docummentation
to develop simple or complex 2D games

Example 2: play sound love2d

sound = love.audio.newSource("pling.wav", "static") -- the "static" is better for short sound effects (load the file into memory)
music = love.audio.newSource("techno.ogg", "stream") -- the "stream" is better for longer music tracks (stream the file from disk)

sound:play()
music:play()

music:setVolume(0.6) -- 90% of ordinary volume
sound:setPitch(0.1) -- one octave lower

Tags:

Lua Example