hi,
this is:
bouncer.exe (dbc) neo-traditional stocking filler
screenshot:
the ball bounces and eats the matrix while you attack the ball
with the cone...
simple arrowkeys control....
you'll be bored in 3 minutes...(my kids were)
but conceptually quite cute.
put it on a floppy and stuff it in a stocking
download:
http://www.calvertonsound.com/bouncer.exe
source code:
set display mode 800,600,16
sync on : sync rate 120 : randomize timer() : hide mouse
` graphics
ink rgb(255,0,0),0
box 0,0,100,100
ink rgb(0,255,0),0
box 100,0,200,100
ink rgb(0,0,255),0
box 200,0,300,100
ink rgb(255,255,0),0
box 0,100,100,200
ink rgb(255,0,255),0
box 100,100,200,200
ink rgb(0,255,255),0
box 200,100,300,200
ink rgb(155,155,0),0
box 0,200,100,300
ink rgb(255,155,0),0
box 100,200,200,300
ink 0,0
box 200,200,300,300
get image 1,0,0,300,300
`
cls 0
ink rgb(255,255,255),0
text 0,0,"BOUNCER BOUNCER BOUNCER BOUNCER"
text 0,20,"BOUNCER BOUNCER BOUNCER BOUNCER"
text 0,40,"BOUNCER BOUNCER BOUNCER BOUNCER"
text 0,60,"BOUNCER BOUNCER BOUNCER BOUNCER"
text 0,80,"BOUNCER BOUNCER BOUNCER BOUNCER"
get image 2,0,0,310,100
cls 0
` dim statements
dim mat_tex(1,20,20)
if file exist("mat_tex.dat")=1 then delete file "mat_tex.dat"
` matrix
mx#=200
mz#=200
tx#=20
tz#=20
make matrix 1,mx#,mz#,tx#,tz#
prepare matrix texture 1,1,3,3
for x= 0 to 19
for z = 0 to 19
tex=1+rnd(7)
set matrix tile 1,x,z,tex
mat_tex(1,x,z)=tex
save array "mat_tex.dat",mat_tex(0)
next z
next x
update matrix 1
set matrix 1,1,0,1,1,1,1,1
` bouncer
make object sphere 1,10
texture object 1,1
make object box 2,10,10,10:hide object 2
set object collision on 2
sx#=20+rnd(160):sz#=20+rnd(160)
sa#=rnd(360)
` eater
make object cone 11,10
xrotate object 11,90
fix object pivot 11
texture object 11,1
make object box 12,10,10,10:hide object 12
set object collision on 12
ex#=20+rnd(160):ez#=20+rnd(160)
` light camera and backdrop
make light 1 : position light 1,100,100,100
position camera 100,170,-50
point camera 100,-10,100
texture backdrop 2
` start lifes
elife=5
`
do
` position bouncer
position object 1,sx#,sy#+5,sz#
rotate object 1,sa#,sa#,sa#
position object 2,limb position x(1,0),limb position y(1,0),limb position z(1,0)
` move and rotate bouncer
sa#=wrapvalue(sa#+0.3)
sx#=newxvalue(sx#,sa#,1):sz#=newzvalue(sz#,sa#,1)
` define bouncer bounderies
if sx#<20 or sx#>180 or sz#<20 or sz#>180 then sa#=wrapvalue(sa#+3)
` control bounce
if bounce=0 then sy#=sy#+1
if bounce=1 then sy#=sy#-1
if sy#>20 then bounce=bounce+1
if sy#<0 then bounce=bounce-1
` bouncer deletes matrix squares
if sy#<0
tx=(tx#/mx#)*sx#
tz=(tz#/mz#)*sz#
if tx>-1 and tx<20
if tz>-1 and tz<20
set matrix tile 1,tx,tz,9
set matrix tile 1,0,0,1
update matrix 1
mat_tex(1,tx,tz)=9
save array "mat_tex.dat",mat_tex(0)
endif
endif:endif
` position eater
position object 11,ex#,ey#+5,ez#
yrotate object 11,ea#
position object 12,limb position x(11,0),limb position y(11,0),limb position z(11,0)
if ex#<-5 then ex#=-5
if ex#>205 then ex#=205
if ez#<-5 then ez#=-5
if ez#>205 then ez#=205
` move eater
if upkey()=1 then ex#=newxvalue(ex#,ea#,1):ez#=newzvalue(ez#,ea#,1)
if downkey()=1 then ex#=newxvalue(ex#,ea#,-1):ez#=newzvalue(ez#,ea#,-1)
if leftkey()=1 then ea#=wrapvalue(ea#-3)
if rightkey()=1 then ea#=wrapvalue(ea#+3)
` eater bounce
if ebounce=0 then ey#=ey#+1
if ebounce=1 then ey#=ey#-1
if ey#>20 then ebounce=ebounce+1
if ey#<0 then ebounce=ebounce-1
` eater zone check
if ey#<0
etx=(tx#/mx#)*ex#
etz=(tz#/mz#)*ez#
if etx>-1 and etx<20
if etz>-1 and etz<20
load array "mat_tex.dat",mat_tex(0)
etex=mat_tex(1,etx,etz)
if etex=9 then ey#=ey#-2
endif:endif
endif
` minus eater life if swallowed
if ey#<-5 then elife=elife-1:ex#=0:ey#=7:ez#=0:ea#=0:ebounce=0
` give points if eater collides with bouncer
if object collision(2,12)>0
score=score+10
sx#=20+rnd(160)
set object collision off 2
else
set object collision on 2
endif
` score board
ink rgb(255,0,0),0
box 10,10,130,120
ink rgb(222,222,222),0
text 20,20,"SCORE "+str$(score)
text 20,40,"LIFES "+str$(elife)
text 20,60,"EATER "+str$(eater)
text 20,80,"BOUNCER "+str$(bouncer)
` reset if score more than 90
if score>90
for x= 0 to tx#-1
for z= 0 to tz#-1
tex=1+rnd(7)
set matrix tile 1,x,z,tex
mat_tex(1,x,z)=tex
save array "mat_tex.dat",mat_tex(0)
next z
next x
update matrix 1
score=0
elife=5
eater=eater+1
endif
` reset if lifes less than 1
if elife<1
for x= 0 to tx#-1
for z= 0 to tz#-1
tex=1+rnd(7)
set matrix tile 1,x,z,tex
mat_tex(1,x,z)=tex
save array "mat_tex.dat",mat_tex(0)
next z
next x
update matrix 1
score=0
elife=5
bouncer=bouncer+1
endif
`
sync
loop
`
rem thanks to the man for this sleep function
function xsleep(length)
waited=timer()
while timer() < waited+length
endwhile
rem
endfunction
rem
lots of luv,
miki.
in the end