Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions Episode 6/enemy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function Enemy.new(x,y)
instance.speed = 100
instance.speedMod = 1
instance.xVel = instance.speed
instance.scaleX = 1

instance.rageCounter = 0
instance.rageTrigger = 3
Expand Down Expand Up @@ -80,6 +81,7 @@ end

function Enemy:flipDirection()
self.xVel = -self.xVel
self.scaleX = -self.scaleX
end

function Enemy:animate(dt)
Expand All @@ -106,11 +108,7 @@ function Enemy:syncPhysics()
end

function Enemy:draw()
local scaleX = 1
if self.xVel < 0 then
scaleX = -1
end
love.graphics.draw(self.animation.draw, self.x, self.y + self.offsetY, self.r, scaleX, 1, self.width / 2, self.height / 2)
love.graphics.draw(self.animation.draw, self.x, self.y + self.offsetY, self.r, self.scaleX, 1, self.width / 2, self.height / 2)
end

function Enemy.updateAll(dt)
Expand Down