local assets = vci.assets local count = 0 local timecount=0 --Synchronization management using a sync variable if vci.state.Get("COUNT") then count = vci.state.Get("COUNT") end --The total number of switchable textures... This time its 4x4 local TOTAL = 16 -- The number of separation in vertical and horizontal directions: 4 function SetTextureOffset( count ) local offset = Vector2.zero -- y shift local Yshift = math.floor(count / 4) offset.y = -(1/4) * Yshift -- x shift local Xshift = count % 4 offset.x = (1/4) * Xshift assets._ALL_SetMaterialTextureOffsetFromIndex(0, offset) end SetTextureOffset(count) --use the update as the updateAll result in duplicate processing between users function update() timecount=timecount+1 --Flip the image in how many frames if timecount>3 then anim() timecount=0 end end --Proprietary function function anim() if count >= TOTAL then count = 0 else count = count + 1 end vci.state.Set("COUNT", count) SetTextureOffset(count) end