This commit is contained in:
bizcochito 2022-01-18 21:11:11 +01:00
parent 9995123c81
commit 2b48358ce7
1 changed files with 0 additions and 146 deletions

146
main.lua
View File

@ -141,149 +141,3 @@ function love.draw()
drawGame()
end
end
=======
function love.load()
arrow = 0
do_pause = false
debug = false
debug_collision = false
editor_mode = false
textScale = 1
fps_count = 0
fps_second = 0
fps_draw = 0
fps_total = 0
love.graphics.setColor(1,1,1)
love.keyboard.setKeyRepeat(true)
love.graphics.setDefaultFilter("nearest") -- good pixel
game = {
scale = 2,
width = love.graphics.getWidth(),
height = love.graphics.getHeight(),
paused = false
}
require "data/scripts"
Canvas = {
Darkness = CreateDarkness()
}
love.graphics.setCanvas(Canvas.Darkness)
SetDarkness()
love.graphics.setCanvas()
Camera.width = game.width
Camera.height = game.height
levelList = {"level1","2","3","ewae","tileset"}
levelNum = 1
currLevel = levelList[levelNum]
LoadedEntities = {}
LevelLoadTiles()
main_Player = Player:New(75,50)
table.insert(LoadedEntities,main_Player)
table.insert(LoadedEntities,Kupo:New(100,150))
table.insert(LoadedEntities,Kupo:New(300,150))
table.insert(LoadedEntities,Decoration:New(200,89,animation.decoration.candelabra,80))
table.insert(LoadedEntities,Fairy:New(200,88))
gravity = 0.2
end
function love.update(dt)
-- fps counter
if fps_second >= 1 then
fps_second = fps_second - 1
fps_draw = fps_count
fps_count = 0
fps_total = fps_total + 1
end
fps_second = fps_second + dt
fps_count = fps_count + 1
current_dt = dt
if editor_mode then
stepEditor()
else
stepGame()
end
end
function love.wheelmoved(_, y)
if editor_mode then
if palette then
p_scroll = p_scroll + y or 0
else
local oscale = game.scale
game.scale = math.max(0.1,game.scale + y/16)
end
end
end
function love.keypressed(key)
if key == "escape" then
if do_pause then
do_pause = false
else
pausepage = 1
do_pause = true
end
end
if key == "f1" then
if debug then
debug = false
debug_collision = true
elseif debug_collision then
debug_collision = false
else
debug = true
end
end
if key == "f2" then
if editor_mode then
else
main_Player.pos.x, main_Player.pos.y = 16,-10
end
end
if key == "f3" then
LoadLevel()
end
if key == "f4" then
if editor_mode then
editor_mode = false
else
editor_mode = true
end
end
end
function love.draw()
if game.width ~= love.graphics.getWidth() or game.height ~= love.graphics.getHeight() then
game.width = love.graphics.getWidth()
game.height = love.graphics.getHeight()
game_resize = true
else
game_resize = false
end
if editor_mode then
drawEditor()
else
drawGame()
end
love.graphics.print(arrow,10,40)
end
>>>>>>> 5f0256e0afc22c4f091fb621b7ff06b7d3be79c7