Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit)

Overlap Script

Effect: When the platform overlaps a character or a bullet, it will become semi-transparent.

Usage: tag all platform and character/bullet you want to have this effect with the same tag of this script

function Start()
    list = {{},{}}
    list1 = list[1]
    list2 = list[2]
end
function Update()
    for i = 1,#list1 do
        list1[i] = nil
    end
    for i = 1,#list2 do
    list2[i] = nil
    end
end
function UpdateS()
    scene = 1
    local index = shape.Bg and 1 or 2
    local tlist = list[index]
    tlist[#tlist+1] = shape
end
function LateUpdate()
    if #list2 > 0 then
        --print(#list1)
        for i = 1,#list1 do
            obj1 = list1[i]
            for j = 1,#list2 do
                if obj1:Overlap(list2[j]) then
                    obj1.Alpha = 0.5
                    break
                end
            end
        end
    end
end