Open-Terrarium/main.lua

64 lines
1.2 KiB
Lua
Raw Normal View History

--the directory
dir = love.filesystem.getAppdataDirectory( )
2017-06-22 03:38:12 -04:00
math.randomseed(os.time())
dofile("tserial.lua")
2017-06-28 02:21:20 -04:00
dofile("ore.lua")
2017-06-19 02:15:21 -04:00
dofile("map.lua")
2017-06-19 02:46:07 -04:00
dofile("menu.lua")
dofile("collision.lua")
2017-06-22 03:38:12 -04:00
dofile("player.lua")
--the scale of the map
2017-07-07 03:42:19 -04:00
scale = 16
2017-06-19 02:15:21 -04:00
function love.draw()
maplib.draw()
2017-06-19 02:46:07 -04:00
player.draw()
menu.draw()
2017-06-19 02:15:21 -04:00
end
function love.load()
maplib.createmap()
2017-06-20 01:59:18 -04:00
2017-06-19 02:46:07 -04:00
font = love.graphics.newFont("font.ttf", 12)
fontmed = love.graphics.newFont("font.ttf", 22)
fontbig = love.graphics.newFont("font.ttf", 35)
2017-06-20 01:59:18 -04:00
2017-06-19 02:46:07 -04:00
love.graphics.setFont(font)
2017-06-20 01:59:18 -04:00
2017-06-20 02:16:21 -04:00
2017-06-20 01:59:18 -04:00
minesound = love.audio.newSource("mine.ogg", "static")
2017-06-20 02:16:21 -04:00
placesound = love.audio.newSource("place.ogg", "static")
2017-06-20 03:44:53 -04:00
stepsound = love.audio.newSource("step.ogg", "static")
2017-06-20 03:49:11 -04:00
oof = love.audio.newSource("oof.ogg", "static")
2017-07-07 03:42:19 -04:00
texture_table = {}
local i = 1
for key,value in pairs(ore) do
texture_table[i] = love.graphics.newImage("textures/"..value.image)
i = i + 1
end
2017-07-07 04:10:42 -04:00
playertexture = love.graphics.newImage("textures/player.png")
2017-06-19 02:15:21 -04:00
end
2017-06-20 03:09:33 -04:00
function love.quit( )
print("Thanks for playing!")
return nil
2017-06-20 02:58:58 -04:00
end
2017-06-19 02:15:21 -04:00
function love.update(dt)
2017-06-19 02:46:07 -04:00
menu.animate()
2017-06-20 03:19:57 -04:00
mine(key)
2017-06-20 03:39:40 -04:00
gravity(dt)
player.move_camera(dt)
--debug
if love.keyboard.isDown("space") then
print("clear")
end
2017-06-19 02:15:21 -04:00
end