I may aswell make this post have some use to it.
A memblock is a place in memory. I only know how to use image memblocks. With an image memblock you can change data within an image while not slowing the computer down much.
There is a tutorial in the forums so there is no point in me trying to explain it all. Go to the dark basic pro discussion forums (the one at the top). Then go to the sticky called coding challenges. Then on page 84 you will see that someone has posted a link to a tutorial. I used it yesterday to learn. This is what I have created today...
`scroll image with memeblocks
sync on
backdrop on
hide mouse
color backdrop 0
width=100
height=100
depth=32
make memblock 1, width*height*4 + 12
write memblock dword 1,0,width
write memblock dword 1,4,height
write memblock dword 1,8,depth
for ix=1 to width
for iy=1 to height
position = ((iy-1)*width + ix - 1)*4 + 12
color=rgb(ix,iy,abs(ix-iy))
write memblock dword 1, position, color
next iy
next ix
make image from memblock 1, 1
make object cube 1,10
texture object 1,1
speed=2
do
sync
yrotate object 1,object angle y(1)+.01
if timer()/(speed+0.0)=timer()/speed
for ix=1 to width
for iy=height to 1 step -1
gposition = ((iy-2)*width + ix-1)*4 + 12
position = ((iy-1)*width + ix-1)*4 + 12
if gposition>=12
color=memblock dword(1,gposition)
else
color=memblock dword(1,((height-1)*width + ix-1)*4 + 12)
endif
r=rgbr(color)
g=rgbg(color)
b=rgbb(color)
color2=rgb(r,g,b)
write memblock dword 1, position, color2
next iy
next ix
make image from memblock 1, 1
texture object 1,1
endif
if timer()/10.0=timer()/10
if shiftkey()=1 then inc speed
if controlkey()=1 then dec speed
if speed=0 then speed=1
endif
text 1,1,str$(speed)
loop
and
`fire
randomize timer()
sync on
backdrop on
hide mouse
color backdrop 0
autocam off
global width=100
global height=100
global depth=32
make memblock 1, width*height*4 + 12
write memblock dword 1,0,width
write memblock dword 1,4,height
write memblock dword 1,8,depth
make image from memblock 1, 1
make object cylinder 1,100
set object ambient 1,100
for i=2 to 50
instance object i,1
h=rnd(19)+1
scale object i,rnd(19)+1,h,rnd(19)+1
texture object i,1
position object i,rnd(200)-100,h/2,rnd(200)-100
next i
h=rnd(19)+1
scale object 1,rnd(19)+1,h,rnd(19)+1
texture object 1,1
position object 1,rnd(200)-100,h/2,rnd(200)-100
position camera 0,2,0
make object plain 51,200,200,1
xrotate object 51,90
loops=0
do
sync
if loops=0
fire_effect(1,1)
for i=1 to 50
texture object i,1
next i
loops=10
endif
dec loops
`control camera
x#=camera angle x()
xrotate camera 0
move camera (upkey()-downkey())/10.0
yrotate camera camera angle y()+90
move camera (rightkey()-leftkey())/10.0
yrotate camera camera angle y()-90+mousemovex()
xrotate camera x#+mousemovey()
if camera angle x()>90 then xrotate camera 90
if camera angle x()<-90 then xrotate camera -90
loop
function fire_effect(img,mem)
for ix=1 to width
position = ((height-1)*width+(ix-1))*4+12
r=rnd(256)
g=rnd(r/2)
color=rgb(r,g,0)
write memblock dword mem,position,color
next ix
for ix=1 to width
for iy=1 to height-1
position=((iy-1)*width+ix-1)*4+12
gposition=((iy)*width+ix-1)*4+12
color=memblock dword(mem,gposition)
r=rgbr(color)
g=rgbg(color)
b=rgbb(color)
r=r-rnd(6)
g=g-rnd(6)
if r<0 then r=0
if g<0 then g=0
color2=rgb(r,g,b)
write memblock dword 1,position,color2
next iy
next ix
make image from memblock img,mem
endfunction
I hope I helped.
Insanity is just a state of mind