# Qbasicnews.com

## Qbasic "like" compilers/interpreters => FB Projects => Topic started by: Skyler on January 04, 2007, 05:16:04 PM

 Title: "Explosion" Post by: Skyler on January 04, 2007, 05:16:04 PM My "explosion":Code:randomize timertype particles    x as integer    y as integer    vs as integer    va as integerend typeconst PARTICLE = 20000dim sparks(PARTICLE) as particlesdim red(6,6)dim white(6,6)dim brown(6,6)startx = 1024 / 2starty = 768 / 2xmot = 2ymot = 2for i = 1 to PARTICLE    sparks(i).x = startx    sparks(i).y = starty    sparks(i).vs = int(rnd * 10 + 1)    sparks(i).va = int(rnd * 359 + 1)next iscreen 20for x = 1 to 6    for y = 1 to 6        read c        pset (x, y), c    next ynext xget (0,0)-(6,6), redclsfor x = 1 to 6    for y = 1 to 6        read c        pset (x, y), c    next ynext xget (0,0)-(6,6), whiteclsfor x = 1 to 6    for y = 1 to 6        read c        pset (x, y), c    next ynext xget (0,0)-(6,6), brownwhile inkey = ""for i = 1 to PARTICLE    dist = sqr(((sparks(i).x - startx)^2) + ((sparks(i).y - starty)^2))    if dist < 150 then         put (sparks(i).x, sparks(i).y), white    elseif dist < 300 and dist > 150 then        put (sparks(i).x, sparks(i).y), red    elseif dist > 300 then        put (sparks(i).x, sparks(i).y), brown    end if    if sparks(i).va < 90 then         sparks(i).x = int(sin(sparks(i).va) * sparks(i).vs) + sparks(i).x         sparks(i).y = int(cos(sparks(i).va) * sparks(i).vs) + sparks(i).y    elseif sparks(i).va > 90 AND sparks(i).va < 180 then         a = sparks(i).va - 90        sparks(i).x = int(sin(sparks(i).va) * sparks(i).vs) + sparks(i).x         y = int(cos(sparks(i).va) * sparks(i).vs) + sparks(i).y        sparks(i).y = 2 * (starty - y) + starty    elseif sparks(i).va > 180 AND sparks(i).va < 270 then         a = sparks(i).va - 180        x = int(sin(sparks(i).va) * sparks(i).vs) + sparks(i).x         sparks(i).x = 2 * (startx - x) + startx        y = int(cos(sparks(i).va) * sparks(i).vs) + sparks(i).y        sparks(i).y = 2 * (starty - y) + starty    elseif sparks(i).va > 270 AND sparks(i).va < 360 then        a = sparks(i).va - 270        x = int(sin(sparks(i).va) * sparks(i).vs) + sparks(i).x        sparks(i).x = 2 * (startx - x) + startx        sparks(i).y = int(cos(sparks(i).va) * sparks(i).vs) + sparks(i).y    end if    if sparks(i).x > 1024 or sparks(i).x < 0 or sparks(i).y > 768 or sparks(i).y < 0 then        sparks(i).x = startx : sparks(i).y = starty    end ifnext iclsstartx = startx + xmotstarty = starty + ymotif startx <= 0 or startx >= 1024 then xmot = -xmotif starty <= 0 or starty >= 768 then ymot = -ymotwenddata 0,0,4,4,0,0data 0,4,4,4,4,0data 4,4,4,4,4,4data 4,4,4,4,4,4data 0,4,4,4,4,0data 0,0,4,4,0,0data 0,0,14,14,0,0data 0,14,14,14,14,0data 14,14,14,14,14,14data 14,14,14,14,14,14data 0,14,14,14,14,0data 0,0,14,14,0,0data 0,0,6,6,0,0data 0,6,6,6,6,0data 6,6,6,6,6,6data 6,6,6,6,6,6data 0,6,6,6,6,0data 0,0,6,6,0,0 Title: "Explosion" Post by: xteraco on January 26, 2007, 10:09:08 PM Nice.  8) Title: "Explosion" Post by: BadMrBox on January 28, 2007, 01:41:37 AM I would say it looks rather cool :) Title: "Explosion" Post by: Skyler on January 29, 2007, 09:57:35 PM Needs more details though. Like a cloud. Plasma. Yeah.