Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

seed/flood fill recolors all of the pixels that are the same color instead of just an area?

Asked by 9 years ago

hey im making a seed/flood fill script for my ROBLOX PAINT game

but the thing is: it fills in everything

then it gets REALLY laggy (ive kinda fixed the laggy part with a 'break' thingy)

i think its just this part because it seems to ignore the position for the most part:

if  (frames[i][3]==frames[frame1][3]-1 and frames[i][1].BackgroundColor3==bcolor) or (frames[i][2]==frames[frame1][2]-1 and frames[i][1].BackgroundColor3==bcolor) or (frames[i][3]==frames[frame1][3]+1 and frames[i][1].BackgroundColor3==bcolor) or (frames[i][2]==frames[frame1][2]+1 and frames[i][1].BackgroundColor3==bcolor) then

but heres the whole thing if u think its something else:

function fill(frame,bcolor)
    local frameX = 0
    local frameY = 0
    local frame1 = nil 
    for i=1,#frames do
        if frames[i][1]==frame then
            frameX=frames[i][2]
            frameY=frames[i][3]
            frame1=i
        end
    end
    repeat wait() until frame1
    for i=1,#frames do
        if frame1 then
            --print("jesus christ does this work")
            if  (frames[i][3]==frames[frame1][3]-1 and frames[i][1].BackgroundColor3==bcolor) or (frames[i][2]==frames[frame1][2]-1 and frames[i][1].BackgroundColor3==bcolor) or (frames[i][3]==frames[frame1][3]+1 and frames[i][1].BackgroundColor3==bcolor) or (frames[i][2]==frames[frame1][2]+1 and frames[i][1].BackgroundColor3==bcolor) then
                frames[i][1].BackgroundColor3=color
                fill(frames[i][1],bcolor)
                print("filled")
                break
            end
        end
    end
end

thanks!!!

0
wtf why'd you guys do the down arrow thingy Joe11Joe99 0 — 9y
0
just because you autistic craps cant figure it out is no reason to downvote it Joe11Joe99 0 — 9y
0
hey im making a seed/flood fill script for my ROBLOX PAINT game but the thing is: it fills in everything then it gets REALLY laggy (ive kinda fixed the laggy part with a 'break' thingy) i think its just this part because it seems to ignore the position for the most part: 1 if (frames[i][3]==frames[frame1][3]-1 and frames[i][1].BackgroundColor3==bcolor) or (frames[i][2]==frames[frame1][2]-1 an Joe11Joe99 0 — 9y
0
I THOUGHT THIS PLACE WAS FOR HELPING PEOPLE WITH THEIR SCRIPTING, NOT TO BE COMPLETE ASSES TO THEM Joe11Joe99 0 — 9y

Answer this question