I’m trying to create a cost for objects but for some reason when it initializes it runs the on_input function and passes the check as if the object is bought upon initialization.
Why does this fire as if I touch/click and release even though I haven’t done so? It actually hits buy_garden function even though I haven’t touched/released anything. Also the check_grid_boundary would return false.
function on_input(self, action_id, action)
if action_id == hash("touch") and action.released then
check_grid_boundary(self)
--check if enough money to buy garden if not reset position
if self.cost <= bank_balance.balance and self.initialized then
buy_garden(self)
else
reset_position(self)
end
elseif action_id == hash("right_mouse") then
check_grid_boundary(self)
end
end