scenes/levels: fix uses of utils

This commit is contained in:
Kazhnuz 2019-03-01 17:38:08 +01:00
parent 0a80e92d9f
commit 6f490512d6
4 changed files with 7 additions and 7 deletions

View File

@ -38,7 +38,7 @@ function Level:cameraFollowPlayer(id)
playy = playy - (self.cameraHeight/2)
if (math.abs(playx) > 8) then
camx = camx + (playx - (8*math.sign(playx)))
camx = camx + (playx - (8*utils.math.sign(playx)))
end
if (playy > 16) then

View File

@ -47,8 +47,8 @@ function Level:drawHUD(dt)
assets.fonts["medium"]:set()
love.graphics.printf( numberToString(self.score, 6), 373, 10, 96, "right")
love.graphics.printf( numberToString(self.gold, 4), 373, 25, 96-18, "right")
love.graphics.printf( utils.math.numberToString(self.score, 6), 373, 10, 96, "right")
love.graphics.printf( utils.math.numberToString(self.gold, 4), 373, 25, 96-18, "right")
love.graphics.setColor(255, 255, 85)
love.graphics.printf( "G", 373, 25, 96, "right")
utils.graphics.resetColor()

View File

@ -88,7 +88,7 @@ function Entity:friction(dt)
if (math.abs(self.xsp) <= self.frc) then
self.xsp = 0
else
self.xsp = self.xsp - (self.frc * math.sign(self.xsp))
self.xsp = self.xsp - (self.frc * utils.math.sign(self.xsp))
end
end
@ -144,8 +144,8 @@ function Entity:move(dt)
end
function Entity:getDirection()
if not (math.sign(self.xsp) == 0) then
self.direction = math.sign(self.xsp)
if not (utils.math.sign(self.xsp) == 0) then
self.direction = utils.math.sign(self.xsp)
end
end

View File

@ -4,7 +4,7 @@ function Player:initWeapon()
end
function Player:launchWeapon()
Weapon(self.level, self.weapon, self.center.x, self.center.y, 350 * math.sign(self.direction))
Weapon(self.level, self.weapon, self.center.x, self.center.y, 350 * utils.math.sign(self.direction))
end
function Player:changeWeapon(id)