no error :/
yes, the hud is adapted from zelda xd. the counter is displayed but it is not updated
yes, the hud is adapted from zelda xd. the counter is displayed but it is not updated
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
local item = ...
function item:on_obtaining(variant, savegame_variable)
self:get_game():get_item("ore_counter"):add_amount(1)
end
local item = ...
function item:on_created()
self:set_savegame_variable("ore")
self:set_amount_savegame_variable("ore_amount")
self:set_max_amount(99)
end
local ore = {}
function ore:new(game)
local object = {}
setmetatable(object, self)
self.__index = self
object:initialize(game)
return object
end
function ore:initialize(game)
self.game = game
self.surface = sol.surface.create(48, 12)
self.digits_text = sol.text_surface.create{
font = "white_digits",
horizontal_alignment = "left",
}
local item = self.game:get_item("ore_counter")
self.digits_text:set_text(item:get_amount())
self.rupee_icons_img = sol.surface.create("hud/rupee_icon.png")
self.money_displayed = item:get_amount()
self:rebuild_surface()
end
function ore:rebuild_surface()
local item = self.game:get_item("ore_counter")
self.surface:clear()
self.money_displayed = item:get_amount()
self.digits_text:set_text(self.money_displayed)
self.digits_text:draw(self.surface, 16, 5)
end
function ore:set_dst_position(x, y)
self.dst_x = x
self.dst_y = y
end
function ore:on_draw(dst_surface)
local x, y = self.dst_x, self.dst_y
local width, height = dst_surface:get_size()
if x < 0 then
x = width + x
end
if y < 0 then
y = height + y
end
self.surface:draw(dst_surface, x, y)
end
return ore