shoot every 4 seconds instead of on input
This commit is contained in:
parent
4d2874c6be
commit
d56b42e017
1 changed files with 2 additions and 1 deletions
|
|
@ -27,6 +27,8 @@ function Player:new(area, x, y, opts)
|
|||
self.max_v = 100
|
||||
-- player acceleration
|
||||
self.a = 100
|
||||
|
||||
self.timer:every(4, function() self:shoot() end)
|
||||
end
|
||||
|
||||
function Player:update(dt)
|
||||
|
|
@ -36,7 +38,6 @@ function Player:update(dt)
|
|||
-- controls
|
||||
if input:down('left') then self.r = self.r - self.rv*dt end
|
||||
if input:down('right') then self.r = self.r + self.rv*dt end
|
||||
if input:pressed('action') then self:shoot() end
|
||||
|
||||
-- update velocity
|
||||
self.v = math.min(self.v + self.a*dt, self.max_v)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue