alunizaje/main.lua

63 lines
1.4 KiB
Lua
Raw Normal View History

2016-11-14 00:35:14 +01:00
local game = require 'assets/scripts/game'
2016-11-12 20:39:10 +01:00
local background = require 'assets/scripts/background'
2016-11-12 13:49:24 +01:00
local spaceship = require 'assets/scripts/spaceship'
2016-11-14 00:35:14 +01:00
local asteroids = require 'assets/scripts/asteroids'
2016-11-27 13:25:40 +01:00
local moon = require 'assets/scripts/moon'
2017-01-05 10:49:04 +01:00
local controls = require 'assets/scripts/gui/controls'
local life = require 'assets/scripts/gui/life'
2016-11-27 12:31:56 +01:00
local camera = require 'assets/scripts/camera'
2016-11-12 13:49:24 +01:00
2016-10-18 13:05:26 +02:00
-- LOAD
2016-10-17 23:41:41 +02:00
function love.load()
2016-11-14 00:35:14 +01:00
game.load()
2016-11-27 12:31:56 +01:00
camera.load(game)
2016-11-14 00:35:14 +01:00
background.load(game)
asteroids.load(game)
2016-11-27 13:25:40 +01:00
moon.load(game)
2016-11-14 00:35:14 +01:00
spaceship.load(game)
2016-12-08 20:02:27 +01:00
controls.load(game)
2017-01-05 10:49:04 +01:00
life.load(game)
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)
2017-01-03 23:49:53 +01:00
if DEBUG then
require('assets/scripts/vendor/lovebird').update()
end
2016-11-14 00:35:14 +01:00
game.world:update(dt)
2016-11-12 20:39:10 +01:00
background.update(dt)
2016-11-26 18:26:48 +01:00
asteroids.update(dt, game)
2016-11-27 13:25:40 +01:00
moon.update()
2016-12-01 21:23:35 +01:00
spaceship.update(dt, game)
2017-01-05 10:49:04 +01:00
life.update(dt, game)
2016-11-27 12:31:56 +01:00
camera.update(game, spaceship)
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-27 12:31:56 +01:00
camera.gcam:draw(function(l,t,w,h)
background.draw()
2016-11-27 13:25:40 +01:00
moon.draw()
2016-12-08 20:49:38 +01:00
spaceship.draw(game)
2016-11-27 12:31:56 +01:00
asteroids.draw()
end)
2016-12-08 20:02:27 +01:00
controls.draw()
2017-01-05 10:49:04 +01:00
life.draw()
2016-10-27 22:41:44 +02:00
end
2016-11-12 13:49:24 +01:00
-- CONTROLS
2017-01-03 22:05:46 +01:00
function love.keypressed(key, scancode, isrepeat)
controls.keypressed(key, scancode, isrepeat)
2016-11-04 00:02:10 +01:00
end
2017-01-03 22:05:46 +01:00
function love.keyreleased(key, scancode)
controls.keyreleased(key, scancode)
end
function love.mousepressed(x, y, button, istouch)
controls.mousepressed(x, y, button, istouch)
end
function love.mousereleased(x, y, button, istouch)
controls.mousereleased(x, y, button, istouch)
2016-11-12 13:49:24 +01:00
end