Quote: "okay.... anyone got an example code that i could try "
Here's a demo written by scout in 2004. You can tell by the way the code is written, the indentation, and the use of trig tables that scout was a programmer from days of old.
rem simple demo effects/technics
rem by scout
rem code snippets july 29 2004
dim sin_tab#(360)
dim cos_tab#(360)
dim campos#(3)
dim camang#(3)
dim lbuf(130)
dim res(3)
dim delay(10)
dim lava#(10,10)
dim bubble(500)
dim digitalh#(16)
dim digitalv#(16)
res(1) = 1024
res(2) = 768
res(3) = 32
for a = 0 to 360
sin_tab#(a) = sin(a)
cos_tab#(a) = cos(a)
next a
set display mode res(1),res(2),res(3)
hide mouse
sync on
sync rate 0
backdrop on
color backdrop rgb(0,0,0)
set camera range 1,10000
fog color rgb(0,0,0)
fog distance 1000
fog on
hide light 0
set ambient light 100
randomize timer()
REM START
scene_two(0)
scene_one(0)
scene_one(1)
scene_one(2)
scene_one(1)
scene_one(3)
scene_one(4)
scene_one(5)
scene_one(6)
interlude(0)
scene_two(0)
interlude(1)
scene_three(0)
interlude(2)
scene_four()
REM END
function rnd_gfx(base_color,color_a,color_b,pro_a,pro_b,img_id)
create bitmap 1,32,32
ink base_color,0
box 0,0,31,31
ink color_a,RGB(0,0,0)
for r = 0 to pro_a*10
dot rnd(31),rnd(31)
next r
ink color_b,RGB(0,0,0)
for r = 0 to pro_b*10
dot rnd(31),rnd(31)
next r
blur bitmap 1,1
get image 1,0,0,31,31
mirror bitmap 1
get image 2,0,0,31,31
flip bitmap 1
get image 4,0,0,31,31
mirror bitmap 1
get image 3,0,0,31,31
delete bitmap 1
create bitmap 1,64,64
set current bitmap 1
paste image 1,0,0
paste image 2,31,0
paste image 3,0,31
paste image 4,31,31
blur bitmap 1,1
get image img_id,2,2,62,62
delete image 1
delete image 2
delete image 3
delete image 4
delete bitmap 1
ink RGB(255,255,255),RGB(0,0,0)
set current bitmap 0
endfunction
function fade(start,ende,speed)
for i = start to ende step speed
g = i
set gamma g,g,g
sync
next i
endfunction
function fade_light(start,ende,speed)
for i = start to ende step speed
g = i
set ambient light g
sync
next i
endfunction
function gamma_flash()
for a = 245 to 255
set gamma a,a,a
sync
next a
for a = 250 to 190 step -20
set gamma a,a,a
sync
next a
set gamma 30,30,30
sync
endfunction
function fade_fog(start,ende,speed)
for i = start to ende step speed
g = i
fog color rgb(g,g,g)
color backdrop rgb(g,g,g)
sync
next i
endfunction
function ani_matrix(matrix,base,amp,speed#,timer,delay)
time = timer()
if time - delay(timer) >= delay
delay(timer) = timer()
for x = 0 to 10
for z = 0 to 10
h# = get matrix height(matrix,x,z)
if h# > 0
if h# >= base+amp
lava#(x,z) = -1
endif
if h# <= base
lava#(x,z) = 1
endif
set matrix height matrix,x,z,h#+lava#(x,z)*speed#
endif
next z
next x
update matrix matrix
endif
endfunction
function bubbles(bubbles,timer,delay)
if first = 0
for i = 1 to bubbles
make object sphere 1000+i,5
scale = int(rnd(98)+1)
bubble(i) = scale
scale object 1000+i,scale,scale,scale
texture object 1000+i,11
ghost object on 1000+i
x = int(rnd(100)+60)
z = int(rnd(100)+60)
y# = get ground height(2,x,z)
position object 1000+i,x,y#-12.5,z
next i
position camera campos#(1),campos#(2),campos#(3)
point camera 0,0,200
first = 1
endif
time = timer()
if time - delay(timer) >= delay
delay(timer) = timer()
for i = 1 to bubbles
bubble(i) = bubble(i) + 1
if bubble(i) = 100 then bubble(i) = 0
scale object 1000+i,bubble(i),bubble(i),bubble(i)
x = object position x(1000+i)
z = object position z(1000+i)
y# = get ground height(2,x,z)
position object 1000+i,x,y#-12.5,z
next i
endif
endfunction
function move_me()
if done = 0
x# = 0
y# = 0
z# = 200
d = -1
a# = 0
d# = 0
r# = 0
done = 1
endif
if done = 1
zrotate camera wrapvalue(a#)
position camera 0,0,z#
a# = a#+5
z# = z# + d
if z# <= 160 then d = 1
if z# >= 240 then d = -1
if a# >= 1440
done = 2
zrotate camera 0
endif
endif
if done = 2
position camera 0,0,z#
z# = z# - 2
if z# = -500 then done = 3
endif
if done = 3
d# = d# + 1
position camera x#,y#,z#
point camera 0-d#,d#,200
x# = newxvalue(x#,camera angle x(),-10)
y# = newxvalue(y#,camera angle y(),10)
z# = newxvalue(z#,camera angle z(),10)
if d# = 150
done = 4
endif
endif
if done = 4
x# = newxvalue(x#,r#,10)
z# = newzvalue(z#,r#,10)
position camera x#,y#,z#
point camera 0-d#,d#,200
r#=wrapvalue(r#+1)
if r# >= 359 then done = 5
endif
if done = 5
d# = d# - 1
position camera x#,y#,z#
point camera 0-d#,d#,200
x# = newxvalue(x#,camera angle x(),10)
y# = newxvalue(y#,camera angle y(),-15)
z# = newxvalue(z#,camera angle z(),-15)
if d# = 0
done = 6
d# = 200
endif
endif
if done = 6
d# = d# - 1
position camera x#,y#,z#
point camera 0,0,d#
x# = newxvalue(x#,camera angle x(),10)
y# = newxvalue(y#,camera angle y(),15)
z# = newxvalue(z#,camera angle z(),15)
if d# = 0
done = 7
a# = 0
endif
endif
if done = 7
a# = wrapvalue(a# + 1)
move camera 20
zrotate camera a#
point camera 0,0,0
if camera position z() >= -100 then done = 8
delay(0) = timer()
endif
endfunction done
function move_it()
if done = 0
done = 1
p = 0
z = 1
a = 1
endif
if done = 1
p = p + 10
z = z + 10
position camera 0,30,z
if p = 720
p = 0
position object a,0,0,object position z(a) + 1440
inc a
if a = 3 then a = 1
endif
endif
endfunction
REM INTERLUDES
function interlude(part)
if part = 0
fade_fog(0,255,5)
for i = 0 to 11
get image i+1,1,i*64+1,res(1)-1,(i*64)+64
next i
sync
color backdrop rgb(0,0,0)
delete object 1
delete object 2
delete object 3
delete object 4
delete object 5
sync
for i = 0 to res(1) step 16
start = timer()
do
ende= timer()
if ende-start >= 15
start = timer()
for b = 0 to 11 step 2
paste image b+1,0+i,(b*64)
paste image b+2,0-i,(b*64)+64
next b
sync
exit
endif
loop
next i
for i = 1 to 31
if image exist(i) = 1 then delete image i
next i
endif
if part = 1
for i = 290 to 100 step -1
ir# = i
fov# = 3.14/(ir#/100)
set camera fov fov#
sync
sleep 10
next i#
yrotate camera 180
set camera fov 3.14/2.905
for i = 1 to 125
delete object 30000+i
next i
for i = 1 to 16
delete object 35000+i
next i
for i = 1 to 16
delete object 36000+i
next i
endif
if part = 2
x = 0
start = timer()
for i = 200 to 100 step -2
do
ende = timer()
if ende - start >= 25
start = timer()
x = x + 2
move camera 0.5
point camera x,0,i
sync
exit
endif
loop
next i
for i = 0 to 11
get image i+15,1,i*64+1,res(1)-1,(i*64)+64
next i
sync
autocam off
for i = 1 to 12
make object plain 12000+i,256,16
texture object 12000+i,i+14
lock object on 12000+i
position object 12000+i,0,100-(i*16),155
next i
delete matrix 1
delete matrix 2
for i = 1 to 500
delete object 1000+i
next i
for d = 1000 to 0 step -10
dr# = d
scale# = dr# / 10
start = timer()
do
ende = timer()
if ende - start >= 25
start = timer()
for i = 1 to 12
xrotate object 12000+i, wrapvalue(object angle x(12000+i)+5)
scale object 12000+i,100,scale#,100
next i
sync
exit
endif
loop
next d
for i = 1 to 12
delete object 12000+i
next i
for i = 1 to 31
if image exist(i) = 1 then delete image i
next i
endif
endfunction
REM PARTS
function scene_one(part)
if part = 0
rnd_gfx(RGB(57,99,49),RGB(177,26,4),RGB(117,112,26),30,50,10)
make object cube 1,100
texture object 1,10
make object plain 5,200,200
scale object 5,1000,1000,1000
texture object 5,10
scale object texture 5, 20,20
xrotate object 5,90
position object 5, 0,-100,0
campos#(1) = camera position x()
campos#(2) = camera position x()
campos#(2) = camera position x()
endif
if part = 1
start= timer()
for i = 1 to 360
do
ende=timer()
if ende-start >= 25
start = timer()
rotate object 1,wrapvalue(object angle x(1)+2),wrapvalue(object angle y(1)+2),wrapvalue(object angle z(1)+2)
sync
exit
endif
loop
next i
endif
if part = 2
rnd_gfx(RGB(15,13,233),RGB(21,133,206),RGB(18,72,219),30,30,11)
fade(255,0,-6)
texture object 5,11
fade(0,255,6)
set object rotation zyx 1
endif
if part = 3
rnd_gfx(RGB(114,41,78),RGB(244,3,217),RGB(173,24,141),20,20,12)
fade(255,30,-5)
set object rotation xyz 1
texture object 1,12
endif
if part = 4
start= timer()
for i = 1 to 360
do
ende=timer()
if ende-start >= 25
start = timer()
rotate object 1,wrapvalue(object angle x(1)+2),wrapvalue(object angle y(1)+2),wrapvalue(object angle z(1)+2)
sync
exit
endif
loop
if rnd(30) = 5 then gamma_flash()
next i
endif
if part = 5
set gamma 255,255,255
start= timer()
for i = 1 to 200
do
ende=timer()
if ende-start >= 25
start = timer()
rotate object 1,0,0,wrapvalue(object angle z(1)+5)
position object 1,0,0,object position z(1)+10
sync
exit
endif
loop
next i
endif
if part = 6
rnd_gfx(RGB(114,41,78),RGB(244,3,217),RGB(173,24,141),20,20,12)
dim rot(4)
autocam off
delete object 1
make object cube 1,60
make object cube 2,60
make object cube 3,60
make object cube 4,60
texture object 1,12
texture object 2,12
texture object 3,12
texture object 4,12
position object 1,-575,-50,100
position object 2,-425,-50,100
position object 3,575,100,100
position object 4,425,100,100
for i = 1 to 500 step 4
start = timer()
do
ende = timer()
if ende - start >= 25
start = timer()
position object 1,-575+i,-50,100
position object 2,-425+i,-50,100
position object 3,575-i,100,100
position object 4,425-i,100,100
sync
exit
endif
loop
next i
rot(4) = 4: rot(3) = 3
rot(1) = 1: rot(2) = 2
time = timer()
do
timer = timer()
if timer-time >= 10000 then exit
for i = 0 to 180 step 4
start = timer()
do
ende = timer()
if ende - start >= 25
start = timer()
zrotate object 1,i
zrotate object 2,i
zrotate object 3,i
zrotate object 4,i
sync
exit
endif
loop
next i
for i = 1 to 150 step 4
start = timer()
do
ende = timer()
if ende - start >= 25
start = timer()
position object rot(1),-75+i,-50,100
position object rot(2),75,-50+i,100
position object rot(3),75-i,100,100
position object rot(4),-75,100-i,100
sync
exit
endif
loop
next i
for i = 1 to 4
rot(i) = rot(i) -1
if rot(i) = 0 then rot(i) = 4
next i
loop
autocam on
endif
endfunction
function scene_two(part)
if part = 0
if done = 1
fog off
fade(250,0,-25)
position camera 0,0,200
for i = 1 to 125
show object 30000+i
next i
for i = 1 to 16
show object 35000+i
show object 36000+i
next i
fade(0,250,50)
set gamma 255,255,255
start = timer()
delay(0) = 0
do
ende = timer()
if ende - start >= 25
start = timer()
for i = 1 to 16
scroll object texture 35000+i,digitalh#(i),0
scroll object texture 36000+i,0,digitalv#(i)
next i
if d < 8 then d = move_me()
endif
if delay(0) > 0
if ende - delay(0) >= 5000 then exit
endif
sync
loop
endif
if done = 0
done = 1
autocam off
fog off
ink RGB(55,183,55),RGB(0,0,0)
set cursor 10,10
print 0
get image 20,10,10,20,30
get image 22,10,10,160,30
get image 24,10,10,20,160
ink RGB(3,248,20),RGB(0,0,0)
cls
set cursor 10,10
print 1
get image 21,10,10,20,30
get image 23,10,10,160,30
get image 25,10,10,20,160
ink RGB(255,255,255),RGB(0,0,0)
for i = 1 to 125
make object plain 30000+i,6,10
hide object 30000+i
ghost object on 30000+i
texture object 30000+i,20
if rnd(100) > 50 then texture object 30000+i,21
next i
obj = 1
for y = -240 to 300 step 120
for x = -240 to 300 step 120
for z = -240 to 300 step 120
position object 30000+obj,x,y,z
inc obj
next z
next x
next y
for i = 1 to 16
make object plain 35000+i,480,10
hide object 35000+i
ghost object on 35000+i
texture object 35000+i,22
if rnd(100) > 50 then texture object 35000+i,23
scale object texture 35000+i,6,1
digrnd# = rnd(2)+1
digitalh#(i) = digrnd#/100
if rnd(100) <= 50 then digitalh#(i) = digitalh#(i) * (0-1)
next i
obj = 1
for y = -180 to 240 step 120
for z = -180 to 240 step 120
position object 35000+obj,0,y,z
inc obj
next z
next y
for i = 1 to 16
make object plain 36000+i,10,480
hide object 36000+i
ghost object on 36000+i
texture object 36000+i,24
if rnd(100) > 50 then texture object 36000+i,25
scale object texture 36000+i,1,6
digrnd# = rnd(2)+1
digitalv#(i) = digrnd#/100
if rnd(100) <= 50 then digitalv#(i) = digitalv#(i) * (0-1)
next i
obj = 1
for x = -180 to 240 step 120
for z = -180 to 240 step 120
position object 36000+obj,x,0,z
inc obj
next z
next x
autocam on
fog on
endif
endif
endfunction
function scene_three(part)
if part = 0
fog off
make matrix 1,200,200,30,30
move camera -150
position camera camera position x(),camera position y()+200,camera position z()
point camera 100,0,100
rnd_gfx(RGB(128,127,127),RGB(104,103,103),RGB(89,89,89),40,50,10)
rnd_gfx(RGB(206,83,22),RGB(213,62,16),RGB(223,30,7),30,30,11)
rnd_gfx(RGB(128,127,127),RGB(89,89,89),RGB(223,30,7),40,10,12)
rnd_gfx(RGB(0,0,0),RGB(244,244,0),RGB(255,255,0),25,15,13)
paste image 10,0,0
paste image 11,60,0
paste image 12,0,60
paste image 13,61,61
get image 1,0,0,120,120
start= timer()
for a = 0 to 360 step 2
do
ende=timer()
if ende-start >= 10
start = timer()
set matrix height 1,int(15+9*cos_tab#(a)),int(15+9*sin_tab#(a)),33
set matrix height 1,int(15+10*cos_tab#(a)),int(15+10*sin_tab#(a)),40
set matrix height 1,int(15+11*cos_tab#(a)),int(15+11*sin_tab#(a)),25
set matrix height 1,int(15+12*cos_tab#(a)),int(15+12*sin_tab#(a)),20
set matrix height 1,int(15+13*cos_tab#(a)),int(15+13*sin_tab#(a)),15
exit
endif
loop
update matrix 1
sync
next a
prepare matrix texture 1,1,2,2
start= timer()
for c = 0 to 7
do
ende=timer()
if ende-start >= 250
start = timer()
for a = 1 to 360 step 6
set matrix tile 1,int(15+(1+c)*cos_tab#(a)),int(15+(1+c)*sin_tab#(a)),3
set matrix tile 1,int(14+(1+c)*cos_tab#(a)),int(15+(1+c)*sin_tab#(a)),3
next a
exit
endif
loop
update matrix 1
sync
next c
fade(255,0,-25)
make matrix 2,150,150,10,10
position matrix 2,25,-10,25
position camera 200,100,0
point camera 0,0,200
move camera 50
campos#(1) = camera position x()
campos#(2) = camera position y()
campos#(3) = camera position z()
prepare matrix texture 2,1,2,2
for x = 1 to 9
for z = 1 to 9
set matrix height 2,x,z,30+rnd(5)
set matrix tile 2,x-1,z-1,2
next z
next x
set matrix height 2,1,1,0
set matrix height 2,9,1,0
set matrix height 2,1,9,0
set matrix height 2,9,9,0
set matrix height 2,9,2,0
set matrix height 2,9,8,0
set matrix height 2,8,1,0
update matrix 2
for x = 0 to 10
for z = 0 to 10
if get matrix height(2,x,z) <= 33
lava#(x,z) = 1
else
lava#(x,z) = -1
endif
next z
next x
bubbles(500,2,25)
fade(0,255,25)
for t = 0 to 10
delay(t) = timer()
next t
do
ani_matrix(2,30,5,0.15,1,25)
bubbles(500,2,25)
sync
timer = timer()
if timer-delay(0) >= 20000 then exit
loop
endif
endfunction
function scene_four()
autocam on
fog on
fog color rgb(0,0,0)
fog distance 500
rnd_gfx(RGB(128,127,127),RGB(104,103,103),RGB(89,89,89),40,50,10)
rnd_gfx(RGB(187,187,187),RGB(220,220,220),RGB(255,255,255),40,10,11)
rnd_gfx(RGB(87,87,87),RGB(20,20,20),RGB(55,55,55),40,10,12)
make object plain 1,101,360
make object plain 5,61,361
xrotate object 1,90
make mesh from object 11,1
make mesh from object 15,5
delete object 1
delete object 5
make object 1,11,10
make object 2,11,10
add limb 1,1,15
rotate limb 1,1,90,45,0
offset limb 1,1,50+(30*cos_tab#(45)),30*sin_tab#(45),0
texture limb 1,1,11
add limb 1,2,15
rotate limb 1,2,90,315,0
offset limb 1,2,0-50-(30*cos_tab#(45)),30*sin_tab#(45),0
texture limb 1,2,11
add limb 1,3,15
rotate limb 1,3,270,45,0
offset limb 1,3,50+(30*cos_tab#(45)),3*(30*sin_tab#(45)),0
texture limb 1,3,11
add limb 1,4,15
rotate limb 1,4,270,315,0
offset limb 1,4,0-50-(30*cos_tab#(45)),3*(30*sin_tab#(45)),0
texture limb 1,4,11
add limb 1,5,11
rotate limb 1,5,180,0,0
offset limb 1,5,0,4*(30*sin_tab#(45)),0
texture limb 1,5,12
add limb 1,6,15
rotate limb 1,6,90,45,0
offset limb 1,6,50+(30*cos_tab#(45)),30*sin_tab#(45),360
texture limb 1,6,12
add limb 1,7,15
rotate limb 1,7,90,315,0
offset limb 1,7,0-50-(30*cos_tab#(45)),30*sin_tab#(45),360
texture limb 1,7,12
add limb 1,8,15
rotate limb 1,8,270,45,0
offset limb 1,8,50+(30*cos_tab#(45)),3*(30*sin_tab#(45)),360
texture limb 1,8,12
add limb 1,9,15
rotate limb 1,9,270,315,0
offset limb 1,9,0-50-(30*cos_tab#(45)),3*(30*sin_tab#(45)),360
texture limb 1,9,12
add limb 1,10,11
rotate limb 1,10,180,0,0
offset limb 1,10,0,4*(30*sin_tab#(45)),360
texture limb 1,10,11
add limb 1,11,11
rotate limb 1,11,0,0,0
offset limb 1,11,0,0,360
texture limb 1,11,10
add limb 2,1,15
rotate limb 2,1,90,45,0
offset limb 2,1,50+(30*cos_tab#(45)),30*sin_tab#(45),0
texture limb 2,1,11
add limb 2,2,15
rotate limb 2,2,90,315,0
offset limb 2,2,0-50-(30*cos_tab#(45)),30*sin_tab#(45),0
texture limb 2,2,11
add limb 2,3,15
rotate limb 2,3,270,45,0
offset limb 2,3,50+(30*cos_tab#(45)),3*(30*sin_tab#(45)),0
texture limb 2,3,11
add limb 2,4,15
rotate limb 2,4,270,315,0
offset limb 2,4,0-50-(30*cos_tab#(45)),3*(30*sin_tab#(45)),0
texture limb 2,4,11
add limb 2,5,11
rotate limb 2,5,180,0,0
offset limb 2,5,0,4*(30*sin_tab#(45)),0
texture limb 2,5,12
add limb 2,6,15
rotate limb 2,6,90,45,0
offset limb 2,6,50+(30*cos_tab#(45)),30*sin_tab#(45),360
texture limb 2,6,12
add limb 2,7,15
rotate limb 2,7,90,315,0
offset limb 2,7,0-50-(30*cos_tab#(45)),30*sin_tab#(45),360
texture limb 2,7,12
add limb 2,8,15
rotate limb 2,8,270,45,0
offset limb 2,8,50+(30*cos_tab#(45)),3*(30*sin_tab#(45)),360
texture limb 2,8,12
add limb 2,9,15
rotate limb 2,9,270,315,0
offset limb 2,9,0-50-(30*cos_tab#(45)),3*(30*sin_tab#(45)),360
texture limb 2,9,12
add limb 2,10,11
rotate limb 2,10,180,0,0
offset limb 2,10,0,4*(30*sin_tab#(45)),360
texture limb 2,10,11
add limb 2,11,11
rotate limb 2,11,0,0,0
offset limb 2,11,0,0,360
texture limb 2,11,10
position object 2,0,0,720
position camera 0,30,0
start = timer()
do
ende = timer()
if ende - start >= 25
start = timer()
move_it()
sync
endif
loop
endfunction
Enjoy your day.