Thanks TDK. Sorry, it was my mistake not to state if it was DBP or DBC.
Also, Dabbler, thanks. I did that just now
Well, the game is about done! The shooting does not look perfect, but it works fine.
Here is the full source...
REM Project: Desert Stranded FPS
REM Created: 6/18/2007 9:30:00 PM
REM
REM ***** Main Source File *****
REM
`Initialize
Init()
`Ground Texture + Ground
Create Bitmap 1,512,512
Box 0,0,512,512,rgb(189,183,107),rgb(189,183,107),rgb(189,183,107),rgb(189,183,107)
For x=1 to 5000 : Co=1+Rnd(3)
If Co=1:Col=rgb(107,142,35):Endif
If Co=2:Col=rgb(34,139,34):Endif
If Co=3:Col=rgb(240,230,140):Endif
If Co=4:Col=rgb(85,107,47):Endif
Dot rnd(512),rnd(512),Col
Next x
Get Image 1,0,0,512,512,1
Delete Bitmap 1
Make Matrix 1,10000,10000,15,15 : Randomize Matrix 1,80 : Set Matrix Wireframe Off 1
Prepare Matrix Texture 1,1,1,1
cls
`MiniMap
Create Bitmap 1,100,100
Box 0,0,100,100,rgb(189,183,107),rgb(189,183,107),rgb(189,183,107),rgb(189,183,107)
Ink 0,0 : Line 0,1,100,1 : Line 0,99,100,99 : Line 1,0,1,100 : Line 99,0,99,100
Get Image 50,0,0,100,100
Delete Bitmap 1
cls
`MiniMap Player
Create Bitmap 1,100,100
Box 0,0,4,4,rgb(0,255,0),rgb(0,255,0),rgb(0,255,0),rgb(0,255,0)
Get Image 51,0,0,4,4
Delete Bitmap 1
`MiniMap Enemy
Create Bitmap 1,100,100
Box 0,0,2,2,rgb(255,0,0),rgb(255,0,0),rgb(255,0,0),rgb(255,0,0)
Get Image 52,0,0,2,2
Delete Bitmap 1
`Desert Fog
InitFog()
`Player
Make Object box 1,10,80,10
Position object 1,5000,0,5000
Hide Object 1
Health#=100
`Gun
Load Object "gun.X",20
Lock object on 20 : Move object right 20,10 : move object down 20,30 : scale object 20,10,10,10 : move object 20,25 : turn object left 20,182 : Fix object pivot 20
Cursor=rgb(0,0,0)
Load sound "gunshot.wav",1
`GunBullet
Make object box 21,1,100,800
turn object left 21,180 : Fix object pivot 21
hide object 21
`Enemy
For z=150 to 180
Load Object "beast.x",z : Turn object left z,180 : Fix object pivot z : Scale object z,300,300,300 : Position object z,rnd(10000),0,rnd(10000)
next z
Do
`Player
HandlePlayer()
`Gun
HandleGun()
`Enemies
HandleEnemies()
`MiniMap
HandleMiniMap()
`Camera
HandleCamera()
`Screen
ScreenText()
FASTSync
Loop
Function Init()
Sync On : Sync Rate 0 : AutoCam Off : Set Camera Range 1,6000 : Gosub Variables : Hide Mouse : Color backdrop rgb(189,183,107)
EndFunction
Function InitFog()
Fog On : Fog Distance 1300 : Fog Color 189,183,107
EndFunction
Function HandlePlayer()
MOVE OBJECT 1, (keystate(17)-keystate(31))*2
Move object left 1, (keystate(30)-keystate(32))*2
x# = OBJECT POSITION X(1)
z# = OBJECT POSITION Z(1)
y#= get ground height(1,x#,z#)
Position object 1,x#,y#+5,z#
y# = OBJECT POSITION Y(1)
angle# = OBJECT ANGLE Y(1)
Yrotate object 1,angle#+(mousemovex()*.2)
If Health#<0 then goto IMDEAD
EndFunction
Function HandleGun()
if mouseclick()=1 then play sound 1
position object 21,camera position x(),camera position y(),camera position z()
yrotate object 21,camera angle y() : move object 21,400
For z=1 to 30
If object exist(z+149)
If object collision(21,z+149)=1
Cursor=rgb(255,0,0)
Ink Cursor,0 : Circle screen width()/2, (screen height()/2)+10,5
If mouseclick()=1 then delete object z+149
else
Cursor=rgb(0,0,0)
Ink Cursor,0 : Circle screen width()/2, (screen height()/2)+10,5
endif
else
Cursor=rgb(0,0,0)
endif
next z
Position Mouse screen width()/2, (screen height()/2)+10
Ink Cursor,0 : Circle screen width()/2, (screen height()/2)+10,5
EndFunction
Function HandleEnemies()
for z=1 to 30
If object exist(z+149)
Enemies(z,1)=object position x(z+149) : Enemies(z,2)=object position z(z+149) : ey#=get ground height(1,Enemies(z,1),Enemies(z,2)) : Position object z+149,Enemies(z,1),ey#,Enemies(z,2)
If Distance(z+149,1)>50 : Loop object z+149,1,25 : ang#=AngleY(z+149,1) : Yrotate object z+149,ang# : move object z+149,4 : else : dec Health#,1 : Loop object z+149,232,270 : endif
If object in screen(z+149)=0 then exclude object on z+149 : else exclude object off z+149
Endif
next z
EndFunction
Function HandleMiniMap()
Sprite 50,300,10,50
mx#=x#/100 : mz#=z#/100
Sprite 51,300+mx#,10+mz#,51
For z=1 to 30
if object exist(z+149) : Sprite z,300+(Enemies(z,1)/100),10+(Enemies(z,2)/100),52 : else : if sprite exist(z):delete sprite z:endif : endif
next z
EndFunction
Function HandleCamera()
POSITION CAMERA x#,y#+20,z#
YROTATE CAMERA angle#
MOVE CAMERA -5
cx# = CAMERA POSITION X()
cy# = CAMERA POSITION Y()
cz# = CAMERA POSITION Z()
EndFunction
Function ScreenText()
ink 0,0
Text 20,20,"Screen FPS: "+STR$(Screen FPS())
Text 20,40,"Polys: "+STR$(Statistic(1))
ink rgb(255,0,0),0
box 20,80,Health#+20,100
EndFunction
Variables:
Global x#
Global y#
Global z#
Global angle#
Global cx#
Global cy#
Global cz#
Global mx#
Global mz#
Global Dim Enemies(30,2)
Global ey#
Global Cursor
Global ang#
Global Health#
return
function Distance(Object1,Object2)
dist#=sqrt((object position x(Object1)-object position x(Object2))^2+(object position y(Object1)-object position y(Object2))^2+(object position z(Object1)-object position z(Object2))^2)
endfunction dist#
function AngleY(Object1,Object2)
angy#=atanfull(object position x(Object2)-object position x(Object1),object position z(Object2)-object position z(Object1))
endfunction angy#
IMDEAD:
wait 1000
Repeat
Text 200,200,"YOU LOSE! YOU DIED! AHHH! BE MORE CAREFUL!! AHHH YOU DIED!"
Sync
Until scancode()>0
And I've uploaded the media and exe as well
Have fun.