16
Development / Re: get amount
« on: February 19, 2018, 07:28:57 AM »
Yes that works great thanks! Still going through the Lua API for ideas on the arrow code ..
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.
function shop_heart:on_interaction()
if game:get_life(max)
then game:start_dialog("already_have")
sol.audio.play_sound("bounce")
elseif game:get_money() < 10 then
game:start_dialog("cant_buy")
sol.audio.play_sound("bounce")
else game:start_dialog("empty" , function()
hero:start_treasure("heart" , 1)
game:remove_money(10)
end)
end
end
function shop_arrows:on_interaction()
if item:get_amount("arrow" , 30)
then game:start_dialog("already_have")
elseif game:get_money() < 80 then
game:start_dialog("cant_buy")
sol.audio.play_sound("bounce")
else game:start_dialog("empty" , function()
hero:start_treasure("arrow" , 3)
game:remove_money(80)
end)
end
end