[DBP] Plasma in Motion, you have gotta see this! I must admit for a NewB I make pretty cool stuff!
ok, as I must point out, this is a reworked code, in other words I took code that did one thing and made it do something else! originally this code was the backgroud from the "PlasmaDemo" (a Game of tiles and etc...) included in the dark basic pro edition. I have taken the code and re-worked it into a really cool Plasma effect that is so much more than most plasmas out there, as this one is in motion as it cycles its colors.(most are static BMP's that are randomly changed at short intervals)
it took me about 2 hours to RIP and Re-Wrap ths code. in order to see what it does correctly you will need the "Media" directory from the "PLasmaDemo" directory or Unzip the one I have attached and put it in the project directory for this project.
the code is here:
rem Initialise
sync on : sync rate 0
if check display mode(1024,768,32)=1 then set display mode 1024,768,32
rem Create board data
ink rgb(0,255,0),0
text 10,10,"F/s: "+str$(screen fps())+" "
global t1=2
dim board(4,4)
seq=1 : for y=0 to 4 : for x=0 to 4 : board(x,y)=seq : inc seq : next x : next y
board(4,4)=0
rem Loading screen
`load bitmap "media\gfx\backdrop.jpg" : sync
rem Create scene
create bitmap 1,screen width(),screen height()
`autocam off
rem Create plasma
load image "media\plasma\plasma.bmp",1
for pl=1 to 10
make object plain 100+pl,256,256
position object 100+pl,rnd(30)-15,rnd(30)-15,150
texture object 100+pl,1
set object light 100+pl,0
ghost object on 100+pl,2
next pl
rem Load sounds
load sound "media\sounds\wind1.wav",1
load sound "media\sounds\wind2.wav",2
loop sound 1 : loop sound 2
rem Setup light
set point light 0,100,100,-100
set ambient light 0
rem Start backdrop banding
band=1 : r=0 : g=0 : b=0
rem Shuffle board start position
xx=(screen width()-1)/1.0 : yy=(screen height()-1)/1.0
rem Render loop
do
rem Main visual screen
set current bitmap 0
cls 0 : print screen fps()
`text 10,10,"F/s: "+str$(screen fps())+" "
rem Draw all tiles
for y=0 to 3
for x=0 to 3
sx=x*0 : sy=y*0 : seq=board(x,y)
if seq>0
placey=(seq-1)/4 : placex=(seq-1)-(placey*4)
copy bitmap 1,(placex*xx),(placey*yy),(placex*xx)+xx,(placey*yy)+yy, 0,(x*xx)+sx,(y*yy)+sy,(x*xx)+sx+xx,(y*yy)+sy+yy
endif
next x
next y
rem Render hidden 3D scene
set current bitmap 1
rem Shift plasma plains
p#=wrapvalue(p#+0.1)
randomize 1
for pl=1 to 10
a#=wrapvalue(p#+(pl*45))
x#=rnd(50)-25 : y#=rnd(50)-25
if pl<=5 then position object 100+pl,x#+cos(a#)*50,y#+sin(a#)*50,50-(pl*6)
if pl>=6 then position object 100+pl,x#+cos(a#)*50,y#+sin(a#)*50,pl-160
next pl
rem Shift plasma plains
p#=wrapvalue(p#+0.2)
randomize 5
for pl=1 to 10
a#=wrapvalue(p#+(pl*55))
x#=rnd(50)-20 : y#=rnd(50)-20
if pl<=5 then position object 100+pl,x#+cos(a#)*50,y#+sin(a#)*50,50-(pl*2)
if pl>=6 then position object 100+pl,x#+cos(a#)*50,y#+sin(a#)*50,pl-260
next pl
rem Shift plasma plains
p#=wrapvalue(p#+0.3)
randomize 1
for pl=1 to 10
a#=wrapvalue(p#+(pl*65))
x#=rnd(50)-15 : y#=rnd(50)-15
if pl<=5 then position object 100+pl,x#+cos(a#)*50,y#+sin(a#)*50,50-(pl*6)
if pl>=6 then position object 100+pl,x#+cos(a#)*50,y#+sin(a#)*50,pl-60
next pl
rem Slowly change the backdrop colour
if band=1 then r=r+t1
if band=1 and r>255 then r=255 : band=2
if band=2 then g=g+t1 : r=r-t1
if band=2 and g>255 then g=255 : r=0 : band=3
if band=3 then b=b+t1 : g=g-t1
if band=3 and b>255 then b=255 : g=0 : band=4
if band=4 then r=r+t1 : b=b-t1
if band=4 and r>255 then r=255 : b=0 : band=2
color backdrop rgb(r,g,b)
rem Update screen
position camera 0,0,-150
point camera 0,0,0
sync
loop
Please let me know what you think of it and if you have any other ideas that might make this even cooler or better. thanks.
and please remeber to give credit where credit is due, I did not write the original code, I only re-worked the code to do something different, therefor this is NOT My code, it is Our Code! keep it that way! and Keep on sharing!!!!!