alunizaje/main.lua

39 lines
864 B
Lua
Raw Normal View History

2016-11-12 13:49:24 +01:00
local spaceship = require 'assets/scripts/spaceship'
local controls = require 'assets/scripts/controls'
2016-10-18 13:05:26 +02:00
-- LOAD
2016-10-17 23:41:41 +02:00
function love.load()
2016-10-18 13:05:26 +02:00
-- Configuration
2016-10-17 09:55:00 +02:00
math.randomseed(os.time())
2016-11-12 13:49:24 +01:00
local width, height = love.window.getDesktopDimensions( display )
2016-11-03 00:05:36 +01:00
window = { width = width , height = height }
2016-11-12 13:49:24 +01:00
love.window.setMode(window.width, window.height)
2016-10-18 13:05:26 +02:00
-- Physics
2016-11-12 12:27:08 +01:00
world_meter = 64
gravity = 2
love.physics.setMeter(world_meter) -- Height earth in meters
world = love.physics.newWorld(0, gravity * world_meter, true) -- Make earth
2016-11-12 13:49:24 +01:00
-- Spaceship
spaceship.load(world)
2016-10-17 09:55:00 +02:00
end
2016-10-18 13:05:26 +02:00
-- UPDATE
2016-10-17 09:55:00 +02:00
function love.update(dt)
2016-11-12 13:49:24 +01:00
world:update(dt)
controls.update(dt)
spaceship.update(dt)
2016-10-17 09:55:00 +02:00
end
2016-10-18 13:05:26 +02:00
-- DRAW
2016-10-17 09:55:00 +02:00
function love.draw()
2016-11-12 13:49:24 +01:00
spaceship.draw()
2016-10-27 22:41:44 +02:00
end
2016-11-12 13:49:24 +01:00
-- CONTROLS
2016-10-27 22:41:44 +02:00
function love.keyreleased(key)
2016-11-12 13:49:24 +01:00
-- sounds.keyreleased(key)
2016-11-04 00:02:10 +01:00
end
function love.mousereleased(key)
2016-11-12 13:49:24 +01:00
-- sounds.mousereleased(key)
end