Hello, I a trying to implement a health bar and I am having some trouble.
--healthbar.lua local M = {} local healthBarObject local manageCurrentHealthBar local paint = {type = "gradient", color1 = {0.4, 0.8, 1}, color2 = {0.4, 0.5, 1}, direction = "down"} function M.new(group, object) healthBarObject = object local currentHealthBar = display.newRect(group, centerX, centerY, object.width / 2, 20) \<---- error line currentHealthBar.fill = paint currentHealthBar.id = "currentHealth" --currentHealthBar.enterFrame = manageCurrentHealthBar --listen("enterFrame", currentHealthBar) end manageCurrentHealthBar = function(self) --[[if self.id == "currentHealth" then end]] end return M --main.lua healthbar.new(group, ship)
I get an error pointing to the line that is marked above. I printed out the value of “object” and it is not nil. Any help would be great, thanks!