27 lines
600 B
Lua
27 lines
600 B
Lua
---@class PolygonRoom:Room
|
|
---@field polygon Polygon
|
|
---@field super Room
|
|
---@field timer Timer
|
|
local PolygonRoom = Room:extend()
|
|
|
|
function PolygonRoom:new()
|
|
PolygonRoom.super.new(self)
|
|
self.polygon = Polygon('fill', 100,100, 200,100, 150,200)
|
|
self.timer = Timer()
|
|
end
|
|
|
|
function PolygonRoom:update(dt)
|
|
PolygonRoom.super.update(self, dt)
|
|
if input:pressed('action') then
|
|
self.polygon.mode = 'line'
|
|
end
|
|
self.polygon:update(dt)
|
|
self.timer:update(dt)
|
|
end
|
|
|
|
function PolygonRoom:draw()
|
|
PolygonRoom.super.draw(self)
|
|
self.polygon:draw()
|
|
end
|
|
|
|
return PolygonRoom
|