Skip to content

Commit

Permalink
Scaled the bar and floored the number
Browse files Browse the repository at this point in the history
  • Loading branch information
rater193 committed Apr 18, 2018
1 parent ba14e81 commit 395a3ba
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions baseglasses/baseglasses.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ end
local barBG = v.content.barBG
local barFG = v.content.barFG

local energyStored = math.floor(v.proxy.getEnergyStored())
local energyMax = math.floor(v.proxy.getMaxEnergyStored())

local _y = 8+(i*36)

bg.setPosition(8, _y)
Expand All @@ -97,13 +100,13 @@ end
barBG.setSize(128,12)

barFG.setPosition(8, _y + 23)
barFG.setSize(64,12)
barFG.setSize((energyStored/energyMax) * 128,12)

textName.setPosition(10, _y+2)
textName.setText("Battery: " .. tostring(v.name) .. "")

textPower.setPosition(10, _y+2+10)
textPower.setText("Power: " .. tostring(v.proxy.getEnergyStored()) .. "/" .. tostring(v.proxy.getMaxEnergyStored()))
textPower.setText("Power: " .. tostring(energyStored) .. "/" .. tostring(energyMax))
end
os.sleep(1)
end
Expand Down

0 comments on commit 395a3ba

Please sign in to comment.