xmas

new topic     » topic index » view thread      » older message » newer message

include rfont.e

constant z=40,s={"Merry  Christmas","Happy  New  Year","   from  jiri   "}
object junk
integer x,y

procedure pause(atom dt)
    atom t
    t=time()+dt
    while time()<t do end while
end procedure

procedure dissolve(sequence s1,sequence s2)
    sequence s
    atom t
    integer flag,h,n,w,x,y
    s=save_image(s1-1,s2+1)
    h=length(s)
    w=length(s[1])
    x=s1[1]-2
    y=s1[2]-2
    while 1 do
        flag=0
        t=time()+0.02
        for r=2 to h-1 do
            for c=2 to w-1 do
                if s[r][c] then
                    flag=1
                    n=0
                    if not s[r-1][c-1] then n=n+1 end if
                    if not s[r-1][c] then n=n+1 end if
                    if not s[r-1][c+1] then n=n+1 end if
                    if not s[r][c-1] then n=n+1 end if
                    if not s[r][c+1] then n=n+1 end if
                    if not s[r+1][c-1] then n=n+1 end if
                    if not s[r+1][c] then n=n+1 end if
                    if not s[r+1][c+1] then n=n+1 end if
                    if n then
                        if rand(n+z)>z then
                            s[r][c]=0
                            pixel(BLACK,{x+c,y+r})
                        end if
                    end if
                end if
            end for
        end for
        while time()<t do end while
        if not flag then exit end if
    end while
end procedure

tick_rate(100)
junk=graphics_mode(18)
set_foreground(BLACK)
while get_key()=-1 do
    x=rand(430)
    y=rand(435)
    ellipse(8+rand(7),1,{x,y},{x+200,y+40})
    setx(x+36) sety(y+13)
    write(s[rand(3)])
    pause(.5)
    dissolve({x,y},{x+200,y+40})
end while
junk=graphics_mode(-1)

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu