-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisual.lua
More file actions
26 lines (19 loc) · 860 Bytes
/
visual.lua
File metadata and controls
26 lines (19 loc) · 860 Bytes
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
local visual = {}
visual.ball = System( {"_entity", "-position", "-width", "-height", "-velocity", "-angle", "!control"}, function(e)
local center = vector(e.position.x + e.width/2, e.position.y + e.height/2)
love.graphics.circle("fill", center.x, center.y, 5, 10)
end )
visual.bricks = System( {"position", "width", "height", "!velocity"}, function(position, width, height)
love.graphics.rectangle("fill", position.x, position.y, width, height)
end )
visual.paddle = System( {"position", "width", "height", "control"}, function(position, width, height)
love.graphics.rectangle("fill", position.x, position.y, width, height)
end )
visual.score = function()
love.graphics.print(score)
end
--Extra visual functions with Observer-pattern
Signal.register( "floorHit", function()
love.graphics.setBackgroundColor(100, 0, 25)
end )
return visual