I’m trying to animate a sprite’s transparency (tint.w
) after a collision, but I don’t know how I would get the correct url of the sprite.
function init(self)
coinModule = require "main.coinModule"
self.trigger = hash("trigger_response")
self.duration = 0.3
self.pos = hash("position")
end
function on_message(self, message_id, message, sender)
if message_id == self.trigger then
if message.enter then
-- Animation
go.animate(message.other_id, self.pos, go.PLAYBACK_ONCE_FORWARD, go.get("/plr", hash("position")), go.EASING_OUTQUART, self.duration)
go.animate(message.other_id#sprite --[[ <----- My problem is here --]], "tint.w", go.PLAYBACK_ONCE_FORWARD, 0, go.EASING_LINEAR, self.duration)
coinModule.changePoints(10)
-- Delete the collectable
timer.delay(self.duration-0.1, false, function()
go.delete(message.other_id, true)
end)
end
end
end