alunizaje/assets/scripts/game.lua

30 lines
725 B
Lua
Raw Normal View History

2016-11-14 00:35:14 +01:00
local game = {}
function game.load()
-- Configuration
math.randomseed(os.time())
2017-01-05 10:49:04 +01:00
PADDING = 50
game.lifes = 3
2016-11-14 00:35:14 +01:00
local width, height = love.window.getDesktopDimensions( display )
game.window = { width = width , height = height }
game.canvas = { width = width, height = 2880 }
love.window.setMode(game.window.width, game.window.height)
game.level = 1
2016-12-08 20:49:38 +01:00
game.play = true
2017-01-05 11:53:52 +01:00
game.die = false
2016-11-14 00:35:14 +01:00
-- Physics
2017-01-03 23:49:53 +01:00
DEBUG = true
2016-11-14 00:35:14 +01:00
local world_meter = 64
local gravity = 2
love.physics.setMeter(world_meter) -- Height earth in meters
game.world = love.physics.newWorld(0, gravity * world_meter, true) -- Make earth
end
2017-01-05 11:53:52 +01:00
function game.update(dt)
if game.die then
game.lifes = game.lifes - 1
game.die = false
end
end
2016-11-14 00:35:14 +01:00
return game