Compare commits

..

No commits in common. "e824579d5e729e0df20a3d5943769be689400f2f" and "74f515a38586e093d8fa459e5f1e74a600490527" have entirely different histories.

4 changed files with 3 additions and 26 deletions

View file

@ -31,8 +31,6 @@ Area = require 'obj/Area'
GameObject = require 'obj/GameObject'
function love.load()
-- slowmo var
slow_amnt = 1
-- table of color palette
COLORS = {
default = {1,1,1,1},
@ -89,7 +87,7 @@ function love.load()
end
function love.update(dt)
if current_room then current_room:update(dt*slow_amnt) end
if current_room then current_room:update(dt) end
input:update(dt)
if input:pressed('f1') then gotoRoom('CircleRoom') end
if input:pressed('f2') and DEBUG then
@ -116,7 +114,7 @@ function love.update(dt)
for k, v in pairs(counts) do print(k, v) end
print("-------------------------------------")
end
camera:update(dt*slow_amnt)
camera:update(dt)
end
function love.draw()
@ -168,7 +166,6 @@ function gotoRoom(room_type, ...)
error("room '"..room_type.."' is not callable (got "..type(Class)..", does room return itself?)")
end
if current_room and current_room.destroy then current_room:destroy() end
if slow_amnt ~= 1 then slow_amnt = 1 end
current_room = _G[room_type](...)
end

View file

@ -11,7 +11,6 @@ function Area:new(room)
self.room = room
self.game_objects = {}
self.world = nil
self.timer = Timer()
end
---Updates area
@ -26,7 +25,6 @@ function Area:update(dt)
table.remove(self.game_objects, i)
end
end
self.timer:update(dt)
end
---Draws area
@ -36,10 +34,6 @@ end
---Destroys area
function Area:destroy()
if self.timer then
self.timer:clear() -- cancel all tweens/after/every
self.timer = nil
end
for i = #self.game_objects, 1, -1 do
local game_object = self.game_objects[i]
game_object:kill()
@ -68,12 +62,4 @@ function Area:addCollisionManager(cell_size)
self.world = HC(cell_size or 100)
end
---Slows down gameplay
---@param amount number percentage to which game will slow down
---@param duration number duration in seconds of slow down
function Area:slow(amount, duration)
slow_amnt = amount
self.timer:tween(duration, _G, {slow_amnt = 1}, 'in-out-cubic')
end
return Area

View file

@ -52,10 +52,6 @@ end
---Destroys room
function Room:destroy()
if self.timer then
self.timer:clear() -- cancel all tweens/after/every
self.timer = nil
end
self.area:destroy()
self.area = nil
end

View file

@ -83,12 +83,10 @@ function Player:shoot()
end
function Player:kill()
self:destroy()
for i=1, random(8,12) do
self.area:addGameObject('ExplodeParticle', self.x, self.y)
end
self.area:slow(.15, 1)
camera:shake(6, 60, .4)
self:destroy()
end
return Player