Fix horizontal meter.

This commit is contained in:
Anna Rose 2023-09-30 17:03:00 -04:00
parent c46ee29caa
commit 9102397c77
2 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@ class("Meter").extends(gfx.sprite)
function Meter:init(value, w, h, vertical) function Meter:init(value, w, h, vertical)
Meter.super.init(self) Meter.super.init(self)
self.vertical = vertical or true self.vertical = vertical
self:setSize(w, h) self:setSize(w, h)
self:setZIndex(999) self:setZIndex(999)
self:setValue(value) self:setValue(value)
@ -29,7 +29,7 @@ function Meter:setValue(value)
y = 0 y = 0
h = self.height h = self.height
x = 0 x = 0
w = self.width - playdate.math.lerp(0, self.width, value / 100) w = playdate.math.lerp(0, self.width, value / 100)
end end
gfx.setColor(gfx.kColorWhite) gfx.setColor(gfx.kColorWhite)
gfx.fillRect(1, 1, self.width-2, self.height-2) gfx.fillRect(1, 1, self.width-2, self.height-2)

View File

@ -7,7 +7,7 @@ import "pipmeter"
class("UI", {}).extends(playdate.object) class("UI", {}).extends(playdate.object)
function UI:init() function UI:init()
self.chargeMeter = Meter(100, 10, 60) self.chargeMeter = Meter(100, 10, 60, true)
self.healthMeter = Meter(100, 60, 10, false) self.healthMeter = Meter(100, 60, 10, false)
self.weaponPowerMeter = PipMeter(0, 4, 4, 4, 3, true) self.weaponPowerMeter = PipMeter(0, 4, 4, 4, 3, true)
self:moveTo(359, 199) self:moveTo(359, 199)