Discord
Login
Community
DARK THEME

drawBar() is not a function?

Im making a game with the progress/health bar v2 Library but when i use the .drawBar() function it says it isnt a function

init = function()
  player = new player()
  abc = test
  staminaBar = new Bar(1000, 10, "bar")
end

update = function()
    player.update()
    staminaBar.updateBar()
    audio.playMusic("background_main", 1, 1)
    staminaBar = stamina
end

draw = function()
  screen.drawMap( "map", 0, 0, 300, 200 )
  staminaBar.drawBar(0 ,0 ,256 ,64 ,0)
  player.draw()

end

Do the rest of the functions in the lib work?

No, updateBar doesnt work either

init = function()
  staminaBar = new bar(1000, 10, "bar")
  stamina = 500   // whatever it is :)
end

update = function()
  staminaBar.progress = stamina
  staminaBar.updateBar()
end

draw = function()
  screen.clear()
  staminaBar.drawBar(0 ,0 ,256 ,64 ,0)
end

The value of the bar is changed by setting (barname).progress , see above. I hope you have the 3 frame sprite?
Also, good idea to use screen.clear at the beginning of the draw loop, or every draw operation will happen on top of the others...

ok so i miswrote "bar" as "Bar"

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community