-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
56 lines (43 loc) · 1.39 KB
/
main.lua
File metadata and controls
56 lines (43 loc) · 1.39 KB
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
function love.load()
-- global declarations
math.randomseed(os.time())
--love.mouse.setVisible(false)
love.window.setMode( 1024, 768 )
-- load all modules
require "player"
require "board"
require "utils"
-- initialization
local joysticks = love.joystick.getJoysticks()
joystick = joysticks[1]
player = Player:new()
player:add_ranger()
board = Board:new()
restart()
end
function restart()
board:initialize()
--board:add_item()
player:go_to_start_position(board)
end
function love.update(dt)
player:update(board)
board:update(player)
if love.keyboard.isDown("escape") then
restart()
end
end
function love.draw()
board:draw(player)
player:draw()
-- board:drawDecoration(player)
love.graphics.draw(player:current_char().image, 0, 650, 0, 2)
if player:current_char().heldItem ~= nil then
love.graphics.draw(player:current_char().heldItem.image, 100, 650, 0, 2)
end
-- INFO
love.graphics.print(tostring("player: "..player:current_char().x..","..player:current_char().y), 200, 670)
love.graphics.print(tostring("player currentChar: "..player.currentChar), 200, 680)
love.graphics.print(tostring("selected tile: "..board.selectedTile[1] .. "," .. board.selectedTile[2]), 200, 690)
love.graphics.print(tostring("selected tile type: "..board:get_tile(board.selectedTile[1], board.selectedTile[2]).tileType), 200, 700)
end