Weeeeee/modules/globals.lua

33 lines
983 B
Lua
Raw Permalink Normal View History

2022-03-02 18:36:52 +01:00
local game = {}
game.debug = true
game.width = 1024
game.height = 768
game.title = "Weeeeeeeee"
game.version = "0.0.1"
game.fullscreen = false
game.level = 1
2022-03-02 20:31:33 +01:00
game.level_count = 1
game.levels = {}
2022-03-03 13:13:17 +01:00
game.objects = {}
--set up physics
love.physics.setMeter(64)
game.world = love.physics.newWorld(0, 9.81*64, true)
2022-03-02 20:31:33 +01:00
game.getcurlevel = function(self)
return self.levels[self.level]
end
2022-03-03 13:13:17 +01:00
2022-03-02 20:31:33 +01:00
for i = 1, game.level_count, 1 do
game.levels[i] = {}
game.levels[i].background = love.graphics.newImage("assets/images/backgrounds/level".. i .."_hires.png")
game.levels[i].width = game.levels[i].background:getWidth()
game.levels[i].height = game.levels[i].background:getHeight()
2022-03-03 13:13:17 +01:00
--print level dimensions
print("Level " .. i .. " dimensions: " .. game.levels[i].width .. "x" .. game.levels[i].height)
2022-03-02 20:31:33 +01:00
game.levels[i].music = love.audio.newSource("assets/audio/music/track".. i ..".ogg", "static")
game.levels[i].music:setLooping(true)
end
2022-03-02 18:36:52 +01:00
2022-03-03 13:13:17 +01:00
2022-03-02 18:36:52 +01:00
return {
game = game
}