Skip to content

Commit

Permalink
Fix some switch blocks not updating when hit
Browse files Browse the repository at this point in the history
  • Loading branch information
alesan99 committed Mar 8, 2022
1 parent c737764 commit cce6da3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions flipblock.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
flipblock = class:new()

local switchblockswitched = false
local switchblockswitched = {false,false,false,false} --should only activate once per frame
function flipblock:init(x, y, t, r)
--PHYSICS STUFF
self.cox = x
Expand Down Expand Up @@ -94,7 +94,7 @@ function flipblock:update(dt)
end

if self.t == "switchblock" then
switchblockswitched = false
switchblockswitched[self.color] = false
self.animtimer = self.animtimer + dt
while self.animtimer > goombaanimationspeed do
if self.quadi == 2 then
Expand Down Expand Up @@ -198,7 +198,7 @@ function flipblock:hit()
self.quad = goombaquad[spriteset][1]
end
elseif self.t == "switchblock" then
if not switchblockswitched then --only switch once if many were hit at the same time
if not switchblockswitched[self.color] then --only switch once if many were hit at the same time
self.on = not self.on
if self.on then
self.quad = flipblockquad[self.color][self.quadi]
Expand Down Expand Up @@ -235,7 +235,7 @@ function flipblock:hit()
end
end

switchblockswitched = true
switchblockswitched[self.color] = true
else
playsound(blockhitsound)
end
Expand Down
4 changes: 2 additions & 2 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ if debugconsole then debuginputon = true; debuginput = "print()"; print("DEBUG O
local debugGraph,fpsGraph,memGraph,drawGraph
local debugGraphs = false

VERSION = 13.0123
VERSIONSTRING = "13e (3/6/22)"
VERSION = 13.0124
VERSIONSTRING = "13e (3/7/22)"

android = (love.system.getOS() == "Android" or love.system.getOS() == "iOS") --[DROID]
androidtest = false--testing android on pc
Expand Down

0 comments on commit cce6da3

Please sign in to comment.