-
Notifications
You must be signed in to change notification settings - Fork 0
/
Console.lua
32 lines (27 loc) · 989 Bytes
/
Console.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
Console = Class {}
SHOW_CONSOLE = false
function Console:display(key)
if key == 'c' and SHOW_CONSOLE == true then
SHOW_CONSOLE = false
elseif key == 'c' and SHOW_CONSOLE == false then
SHOW_CONSOLE = true
end
end
function Console:logBallOwnership()
love.graphics.setColor(getColor('red'))
love.graphics.printf('Ball ownership: ' .. ball.possession, 10, BORDER_LEFT_RIGHT + 10, 300)
end
function Console:logBallPosition()
love.graphics.setColor(getColor('white'))
love.graphics.printf('Ball position X: ' .. ball.x, 10, BORDER_LEFT_RIGHT + 20, 300)
love.graphics.printf('Ball position Y: ' .. ball.y, 10, BORDER_LEFT_RIGHT + 30, 300)
love.graphics.printf('Ball delta X: ' .. ball.dx, 10, BORDER_LEFT_RIGHT + 40, 300)
love.graphics.printf('Ball delta Y: ' .. ball.dy, 10, BORDER_LEFT_RIGHT + 50, 300)
end
-- Console logging
function Console:renderConsole()
if SHOW_CONSOLE == true then
Console:logBallOwnership()
Console:logBallPosition()
end
end