sorry for the offtopic but
here's the lastest version of that game, I think you'll find it usefull.
`team shooter beta by link102
`version 02-01-08
set display mode 1280,1024,32
sync on:sync rate 30
hide mouse
gosub setup_crosshair
c_posX#=500
c_posY#=50
c_posZ#=500
make matrix 1,1500,1500,30,30
gosub setup_color
gosub setup_water
gosub setup_height
gosub setub_horizon
Normalise(1)
fog on
fog color rgb(181,219,221)
fog distance 1900
color backdrop rgb(181,219,221)
do
if spacekey()=1 and sp=0
c_rout=(c_rout=0)
sp=1
if c_rout=1
hide object 1
else
show object 1
endif
endif
if spacekey()=0 then sp=0
if c_rout = 0 then gosub c_routine0
if c_rout = 1 then gosub c_routine1
if c_posY# > -10 and switch=0 then set gamma 255,255,255:switch=1
if c_posY# < -10 and switch=1 then set gamma 100,100,150:switch=0
rotate camera wrapvalue(c_angX#),wrapvalue(c_angY#),wrapvalue(c_angZ#)
position camera c_posX#,c_posY#,c_posZ#
sync
loop
`camera routine 0: just like in a first person shooter; w,a,s,d = movement; shift = crouching and jumping(on release)
c_routine0:
c_angYm# = c_angYm# + mousemoveX() / 5
c_angXm# = c_angXm# + (mousemoveY() * (1-rotlimit)) / 5
c_angY# = c_angY# + c_angYm#
c_angX# = c_angX# + c_angXm#
c_angYm# = c_angYm# * 0.7
c_angXm# = c_angXm# * 0.5
if c_angX#<-80 or c_angX#>80
rotlimit=1
endif
if rotlimit=1
if c_angX#<0 and mousemoveY()>0 then rotlimit=0
if c_angX#>0 and mousemoveY()<0 then rotlimit=0
endif
c_posX# = newXvalue(c_posX#,c_angY# ,(keystate(17)-keystate(31))*5/(k42+1)/((c_posY#<-10)+1))
c_posX# = newXvalue(c_posX#,c_angY#-90,(keystate(30)-keystate(32))*5/(k42+1)/((c_posY#<-10)+1))
c_posZ# = newZvalue(c_posZ#,c_angY# ,(keystate(17)-keystate(31))*5/(k42+1)/((c_posY#<-10)+1))
c_posZ# = newZvalue(c_posZ#,c_angY#-90,(keystate(30)-keystate(32))*5/(k42+1)/((c_posY#<-10)+1))
if c_posX#<20 then c_posX#=20
if c_posX#>1480 then c_posX#=1480
if c_posZ#<20 then c_posZ#=20
if c_posZ#>1480 then c_posZ#=1480
c_velY# = c_velY# + 2
c_posY# = c_posY# - c_velY#
ggg#=get ground height(1,c_posX#,c_posZ#)
if c_posY# <ggg# + 20/(k42+1) then c_posY# = ggg# + 20/(k42+1) : c_velY# = 0
if k42=1 and keystate(42)=0 and c_posY# = ggg# + 20/(k42+1) then c_velY#=-15
k42=keystate(42)
return
`camera routine 1: left and right mousebuttons control the camera
c_routine1:
if mouseclick()=1
c_posm# = c_posm# - mousemoveY() / 2
endif
if mouseclick()=2
c_angYm# = c_angYm# + mousemoveX() / 5
c_angXm# = c_angXm# + mousemoveY() / 5
endif
c_angY# = c_angY# + c_angYm#
c_angX# = c_angX# + c_angXm#
c_angYm# = c_angYm# * 0.5
c_angXm# = c_angXm# * 0.5
c_posX# = newXvalue(c_posX#,c_angY#,c_posm#)
c_posY# = newYvalue(c_posY#,c_angX#,c_posm#)
c_posZ# = newZvalue(c_posZ#,c_angY#,c_posm#)
c_posm# = c_posm# * 0.7
return
`make a 9x9 matrix and make the center invisible
setub_horizon:
cls 0
ink rgb(142,171,135),0:box 0,0,10,10
get image 4,0,0,21,11
make matrix 3,4500,4500,3,3
position matrix 3,-1500,0,-1500
prepare matrix texture 3,4,2,1
set matrix tile 3,1,1,2
set matrix 3,1,0,1,0,0,1,0
update matrix 3
return
`the water in the map, need to make it more blue
setup_water:
`150
ink rgb(80,80,255),0:box 0,0,40,40
get image 2,0,0,41,41
make matrix 2,1500,1500,1,1
prepare matrix texture 2,2,1,1
position matrix 2,0,-10,0
ghost matrix on 2
return
`a heightmap, every number is multiplied by 25, giving a stylisch feel to the map
setup_height:
for x = 0 to 30
for z = 0 to 30
read height
set matrix height 1,x,z,height * 25
next z
next x
update matrix 1
data 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 1, 1,-2,-2, 1, 1, 0, 0, 0, 0
data 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 3, 2, 2, 1, 1, 0, 0, 0, 0, 0, 1, 1,-2,-2, 1, 1, 0, 0, 0, 0
data 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 2, 1, 1, 2, 2, 0, 0, 0, 0
data 0, 0, 0, 1, 2, 2, 1, 2, 2, 3, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 2, 2, 1, 1, 2, 2, 0, 0, 0, 0
data 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
data 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
data 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
data 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
data 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
return
`the block texture of the map
setup_color:
ink rgb(142,171,135),0:box 0,0,40,40
ink rgb(122,151,115),0:line 0,0,40,0:line 0,0,0,40:line 40,40,40,0:line 40,40,0,40
get image 1,0,0,41,41
prepare matrix texture 1,1,1,1
return
setup_crosshair:
ink rgb(255,255,255),0
line 14, 1,14, 9:line 15, 3,15,11
line 28,14,20,14:line 26,15,18,15
line 15,28,15,20:line 14,26,14,18
line 1,15, 9,15:line 3,14,11,14
get image 3,0,0,30,30
make object Plain 1,1,1
position object 1,0,0,20
texture object 1,3
lock object on 1
ghost object on 1
return
`By Lee Bamber From DB Example - Adds shaded areas to matrix to give depth
Function Normalise(MatNum)
For z=1 to 30
For x=1 to 30
h8#=get matrix height(MatNum,x,z-1)*5:`*5 added for even more depth
h4#=get matrix height(MatNum,x-1,z)*5
h#=get matrix height(MatNum,x,z)*5
h2#=get matrix height(MatNum,x,z)*5
x1#=(x-1)*25.0
y1#=h#
x2#=(x+0)*25.0
y2#=h4#
dx#=x2#-x1#
dy#=y2#-y1#
ax#=atanfull(dx#,dy#)
ax#=wrapvalue(90-ax#)
z1#=(z-1)*25.0
y1#=h2#
z2#=(z+0)*25.0
y2#=h8#
dz#=z2#-z1#
dy#=y2#-y1#
az#=atanfull(dz#,dy#)
az#=wrapvalue(90-az#)
nx#=sin(ax#)
ny#=cos(ax#)
nz#=sin(az#)
Set matrix normal MatNum,x,z,nx#,ny#,nz#
next x
next z
Update Matrix MatNum
EndFunction
