-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
60 lines (48 loc) · 1.2 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
require "class"
require "resources"
require "player"
require "world"
require "debugstatus"
require "camera"
require "collision"
require "timer"
require "score"
require "floatingcombattext"
require "platforms"
function love.load()
PlayerCam = camera:new()
DB = debugstatus:new(true)
GameWorld = world:new()
Hero = player:new(5, 100, -100)
LevelPlatforms = platforms:new()
love.mouse.setVisible(false)
-- spawn some test platforms
LevelPlatforms:spawnplatform( 5,love.graphics.getHeight() - 200, 4, 1 )
LevelPlatforms:spawnplatform( 300,love.graphics.getHeight() - 200, 8, 2 )
end
function love.update(dt)
Hero:collidingplatform()
Hero:control(dt)
PlayerCam:follow(Hero)
end
function love.draw()
local msx, msy = love.mouse.getPosition()
LevelPlatforms:draw()
PlayerCam:set()
--love.graphics.draw(spr_skyback_f1, PlayerCam.x, PlayerCam.y)
DB:draw()
Hero:draw()
PlayerCam:unset()
love.graphics.draw(spr_mcursor_f1, msx - spr_mcursor_f1:getWidth()/2, msy - spr_mcursor_f1:getHeight()/2)
end
function love.keypressed(key)
DB:keypressed(key)
if key == "escape" then
love.event.push("quit")
end
Hero:jumping(key)
end
function love.keyreleased(key)
end
function love.mousepressed(x, y, button)
end