exercise 48
This commit is contained in:
parent
40fe3c84cf
commit
2a41828540
1 changed files with 7 additions and 0 deletions
|
|
@ -1,9 +1,14 @@
|
|||
---@class Stage:Room
|
||||
---@field timer Timer
|
||||
local Stage = Room:extend()
|
||||
|
||||
function Stage:new()
|
||||
Stage.super.new(self)
|
||||
self.timer = Timer()
|
||||
self.timer:every(2, function()
|
||||
local latest_object = self.area:addGameObject('Circle', love.math.random(1, 800), love.math.random(1, 600))
|
||||
latest_object.timer:after(love.math.random(2, 4), function() latest_object:kill() end)
|
||||
end)
|
||||
end
|
||||
|
||||
function Stage:update(dt)
|
||||
|
|
@ -18,6 +23,8 @@ function Stage:update(dt)
|
|||
game_object:kill()
|
||||
end
|
||||
end
|
||||
|
||||
self.timer:update(dt)
|
||||
end
|
||||
|
||||
function Stage:draw()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue