set display mode 1280, 1024, 32 sync on sync rate 0 randomize timer() backdrop off color backdrop 0, 0 set ambient light 0 `SET THIS VARIABLE TO SOMETHING BETWEN 0 and 20 to effect the fade FADE as DWORD FADE = 20 :` ********** YOU MAY EDIT ME.. LESS = LONGER TRAILS, HIGHER = MORE DOT-LIKE ********** FADE = FADE << 24 make memblock 1, 12 + (screen width() * screen height() * 4) write memblock dword 1, 0, screen width() write memblock dword 1, 4, screen height() write memblock dword 1, 8, 32 for i = 0 to (screen width() * screen height() * 4)-1 step 4 write memblock dword 1, 12 + i, FADE next make image from memblock 1, 1 delete memblock 1 autocam off position camera 0, 20, 3, 20 point camera 0, 0,25,0 set point light 0, camera position x(), camera position y(), camera position z() make object plain 10000, 100, 100 position object 10000, 0, 0, 0 point object 10000, 0, 1, 0 #constant BUILDING_SIZE 2.0 #constant BUILDING_GRID_X 5 #constant BUILDING_GRID_Y 5 make object cube 1, BUILDING_SIZE make mesh from object 1, 1 StepX# = BUILDING_SIZE * 2 : GridOffsetX# = (BUILDING_GRID_X * (StepX#)) * -0.5 StepY# = BUILDING_SIZE * 2 : GridOffsetY# = (BUILDING_GRID_Y * (StepY#)) * -0.5 i = 1 for x = 0 to BUILDING_GRID_X for y = 0 to BUILDING_GRID_Y sX# = rnd(50) + 75 sY# = rnd(50) + 75 sZ# = rnd(500) + 100 xP# = GridOffsetX# + (StepX# * x) yP# = GridOffsetY# + (StepY# * y) add limb 10000, i, 1 : scale limb 10000, i, sX#, sY#, sZ# : offset limb 10000, i, xP#, yP#, sZ# * BUILDING_SIZE * 0.005 inc i next y next x delete object 1 delete mesh 1 `hide limb 10000, 0 Type VECTOR x as float y as float z as float EndType Type Firework P as VECTOR V as VECTOR a# COLOR as DWORD EndType #constant F_COUNT 20 :` ********** YOU MAY EDIT ME.. FIREWORK COUNT, HIGHER = MORE FIREWORKS BUT LESS FPS ********** #constant F_PARTICLES 32 :` ********** YOU MAY EDIT ME.. FIREWORK PARTICLE COUNT, HIGHER = MORE BITS COMING OFF THE FIREWORK BUT LESS FPS ********** #constant F_GRAVITY -9.8 #constant F_LAUNCH_SPEED 20.0 #constant F_MASS 1.0 Dim Exploded(F_COUNT) Dim FireworkParticles(F_PARTICLES * F_COUNT) as Firework for i = 0 to F_COUNT-1 RESET_FIREWORK(i) next i make light 2 set light range 2, 10000 hide light 2 BangLightTimer = 0 spaceDown = 0 alpha as DWORD frameTime# = 1.0 frameTimeSecs# = 1.0 startTime = timer() do frameTime# = (frameTime# * 0.8) + ((timer() - startTime) * 0.2) startTime = timer() frameTimeSecs# = frameTime# * 0.001 text 0, 0, "FPS: " + str$(screen fps()) if spacekey() if spaceDown = 0 RESET_FIREWORK(rnd(F_COUNT-1)) spaceDown = 1 endif else spaceDown = 0 endif if light visible(2) then if timer() - BangLightTimer > 100 then hide light 2 gosub MOVE_FIREWORK paste image 1, 0, 0, 1 sync loop MOVE_FIREWORK: for i = 0 to F_COUNT - 1 `n = array offset n = (i * F_PARTICLES) + 1 if Exploded(i) = 0 inc FireworkParticles(n).V.y, F_GRAVITY * F_MASS * frameTimeSecs# inc FireworkParticles(n).P.x, FireworkParticles(n).V.x * frameTimeSecs# inc FireworkParticles(n).P.y, FireworkParticles(n).V.y * frameTimeSecs# inc FireworkParticles(n).P.z, FireworkParticles(n).V.z * frameTimeSecs# for j = 0 to F_PARTICLES - 1 p = n+j position object p, FireworkParticles(n).P.x, FireworkParticles(n).P.y, FireworkParticles(n).P.z point object p, camera position x(), camera position y(), camera position z() next j `Check if at right height if FireworkParticles(n).V.y < 2.0 Exploded(i) = 1 for j = 0 to F_PARTICLES - 1 p = n+j FireworkParticles(p).P.x = FireworkParticles(n).P.x FireworkParticles(p).P.y = FireworkParticles(n).P.y FireworkParticles(p).P.z = FireworkParticles(n).P.z FireworkParticles(p).V.x = FireworkParticles(n).V.x + ((rnd(8000)-4000)*0.001) FireworkParticles(p).V.y = FireworkParticles(n).V.y + ((rnd(8000)-4000)*0.001) FireworkParticles(p).V.z = FireworkParticles(n).V.z + ((rnd(8000)-4000)*0.001) show light 2 set point light 2, FireworkParticles(n).P.x, FireworkParticles(n).P.y, FireworkParticles(n).P.z color light 2, FireworkParticles(n).COLOR BangLightTimer = timer() next i endif else for j = 0 to F_PARTICLES-1 p = n+j inc FireworkParticles(p).V.y, F_GRAVITY * F_MASS * frameTimeSecs# inc FireworkParticles(p).P.x, FireworkParticles(p).V.x * frameTimeSecs# inc FireworkParticles(p).P.y, FireworkParticles(p).V.y * frameTimeSecs# inc FireworkParticles(p).P.z, FireworkParticles(p).V.z * frameTimeSecs# position object p, FireworkParticles(p).P.x, FireworkParticles(p).P.y, FireworkParticles(p).P.z point object p, camera position x(), camera position y(), camera position z() dec FireworkParticles(p).a#, frameTime# * 0.15 if FireworkParticles(p).a# > 0 alpha = int(FireworkParticles(p).a#) << 24 color object p, FireworkParticles(p).COLOR + alpha else RESET_FIREWORK(i) endif next j endif next i return function RESET_FIREWORK(f) `n is the offset n = (f * F_PARTICLES) + 1 for i = 0 to F_PARTICLES-1 p = n + i if object exist(p) = 0 if i = 0 make object plain p, 0.1, 0.1 else instance object p, n endif endif FireworkParticles(p).COLOR = rgb(rnd(255), rnd(255), rnd(255)) color object p, FireworkParticles(p).COLOR position object p, 0, 0, 0 set object transparency p, 1 FireworkParticles(p).P.x = rnd(5)-2.5 FireworkParticles(p).P.y = 0 FireworkParticles(p).P.z = rnd(5)-2.5 FireworkParticles(p).a# = 255.0 next i FireworkParticles(n).V.x = (rnd(1000) - 500) * 0.01 FireworkParticles(n).V.y = F_LAUNCH_SPEED + (rnd(700) * 0.01) FireworkParticles(n).V.z = (rnd(1000) - 500) * 0.01 Exploded(f) = 0 endfunction