local assets = vci.assets local count = 0 if vci.state.Get("COUNT") then count = vci.state.Get("COUNT") end local TOTAL = 6 function SetTextureOffset( count ) local offset = Vector2.zero -- y shift local Yshift = math.floor(count / 3) offset.y = -(1/3) * Yshift -- x shift local Xshift = count % 3 offset.x = (1/3) * Xshift assets.material._ALL_SetTextureOffsetFromIndex(0, offset) end SetTextureOffset(count) function onUse(use) if count >= TOTAL-1 then count = 0 else count = count + 1 end vci.state.Set("COUNT", count) SetTextureOffset(count) end