Please help me "upgrade" this program, and explain how it's working. I'm not very good.
rem SETUP GAME SEQUENCE
Rem Setup sync
Sync On
Sync Rate 1000
Draw to front
Backdrop on
Set camera range 1,3000
Autocam off
Hide mouse
Fog on
Fog distance 3000
Fog color RGB(1,128,1)
Color Backdrop RGB(128,128,128)
Rem make matrix
Make matrix 1,10000,10000,20,20
Rem texture matrix
Load image "rock09.bmp",1
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1
rem Make Gun, gun stuff (turned off now)
rem load object "handgun.3ds", 1
rem Fix object pivot 1
rem turn object right 1, 75
rem Scale object 1,25,25,1
rem position object 1,20,-15,50
rem Lock object on 1
Rem 1 = clip capacity, 2 = bullets left, 3 = clips left
nobullet = 0
dim shooter(5)
shooter(1) = 8
shooter(2) = 8
shooter(3) = 1
rem fire texture
Load Image "fire.bmp",2
rem Make Bullet
Make Object Sphere 2,2
texture object 2,2
Hide Object 2
rem Make Explosion
Make Object Sphere 30,20
texture object 30,2
ghost object on 30
Hide Object 30
Make Object Sphere 31,20
texture object 31,2
ghost object on 31
Hide Object 31
rem Load FX sounds
Load 3Dsound "shotgun.wav",2
Load 3Dsound "Explode1.wav",3
rem Randomize the matrix
randomize matrix 1,125
rem Make target Recticle
load image "target.bmp", 1
sprite 1, 304, 227, 1
rem Game Variables
rem player's hp
plife = 100
rem create decorative objects on matrix
load image "rock02.bmp",300
t=300
For x = 1 to 9
For z = 1 to 9
Make object cube t,100
Scale object t,100,600,100
y = get ground height(1,x*1000,z*1000)
position object t,x*1000,y+275,z*1000
texture object t,300
scale object texture t,1,-6
inc t
next z
next x
rem load health bmp
rem load image "health.bmp", 1
Gosub PlacePlayer
Rem Main loop
Do
rem Move your player along
oldcAY# = cAY#
oldcAX# = cAX#
oldX#=X#
oldY#=Y#
oldZ#=Z#
cAY# = WrapValue(cAY#+MousemoveX()*0.2)
cAX# = WrapValue(cAX#+MousemoveY()*0.2)
caZ# = Camera angle Z()
Rem Control input for camera
If Upkey()=1
XTest# = Newxvalue(X#,cAY#,7)
ZTest# = Newzvalue(Z#,cAY#,7)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
If Downkey()=1
XTest# = Newxvalue(X#,Wrapvalue(cAY#-180),7)
ZTest# = Newzvalue(Z#,Wrapvalue(cAY#-180),7)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
If Leftkey()=1
XTest# = Newxvalue(X#,Wrapvalue(cAY#-90),7)
ZTest# = Newzvalue(Z#,Wrapvalue(cAY#-90),7)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
If Rightkey()=1
XTest# = Newxvalue(X#,Wrapvalue(cAY#+90),7)
ZTest# = Newzvalue(Z#,Wrapvalue(cAY#+90),7)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
Rem Rotate camera
cTestX#=WrapValue(cAX#-180)
if cTestX# > 225 then cAX#=45
if cTestX# < 135 then cAX#=315
YRotate camera CurveAngle(cAY#,oldcAY#,24)
XRotate camera CurveAngle(cAX#,oldcAX#,24)
Y# = Get ground height(1,X#,Z#)+35
rem collision detection
if DecoCollide(X#,Y#,Z#) = 1
X#=oldX#
Y#=oldY#
Z#=oldZ#
Endif
Rem Position Camera
Position Camera X#,Y#,Z#
Rem Position Listener
Position Listener X#,Y#,Z#
Rotate Listener 0,cAY#,0
Rem Shoot bullet
if Mouseclick()=1 and Explode = 0
if shooter(2) > 0
if BulletLife=0 or BulletLife<50
Position object 2,X#,Y#-7,Z#
Set object to camera orientation 2
BulletLife = 150
show object 2
play sound 2
shooter(2) = shooter(2) - 1
Endif
else
if shooter(3) > 0
shooter(3) = shooter(3) - 1
shooter(2) = 8
else
nobullet = 1
endif
endif
Endif
If BulletLife > 0 then Gosub ShootBullet
If Explode > 0 then Gosub ExplodeRocket
rem HUD-- heads up display!!
set text size 15
text 250, 415, "Bullets left"
set cursor 255,430
print shooter(2)
set cursor 290, 415
print "/"
text 345, 415, "Clips left"
set cursor 350, 430
print shooter(3)
if mouseclick()=1 & nobullet=1
text 20, 50, "NO BULLETS LEFT"
endif
Rem Refresh Screen
Sync
Loop
Rem check for collision with wall decorations
Function DecoCollide(X#,Y#,Z#)
for u = 1 to 9
for v = 1 to 9
if X#>u*1000-60
if X#<u*1000+60
if Z#>v*1000-60
if Z#<v*1000+60
if Y# < Get ground height(1,u*1000,v*1000)+575
Collide=1
Exitfunction Collide
endif
endif
endif
endif
endif
next v
next u
Collide=0
Endfunction Collide
Rem Shoot player bullet
ShootBullet:
Dec BulletLife
Move object 2,12
bX#=Object position X(2)
bY#=Object position Y(2)
bZ#=Object position Z(2)
if bY# < Get Ground height(1,bX#,bZ#) then BulletLife=0
Position sound 2,bX#,bY#,bZ#
set cursor 10,10
if DecoCollide(bX#,bY#,bZ#) = 1 then BulletLife = 0
if BulletLife = 0
Hide object 2
stop sound 2
Explode = 20
endif
Return
Rem Explode bullet
ExplodeRocket:
Position object 30,bX#,bY#,bZ#
Show object 30
Position object 31,bX#,bY#,bZ#
Show object 31
EScale=20*(30-Explode)
Scale object 30,EScale,EScale,EScale
Yrotate object 30,WrapValue(Explode*37)
Scale object 31,EScale/1.5,EScale/1.5,EScale/1.5
Yrotate object 31,WrapValue(359-Explode*37)
Dec Explode
If Explode = 0 then hide object 30: Hide object 31
If Explode=18
position sound 3,bX#,bY#,bZ#
play sound 3
endif
If Explode < 15 then position sound 3,X#,Y#,Z#
Return
PlacePlayer:
X#=mX#
Y#=mY#
Z#=mZ#
While Sqrt((X# - mX#)^2 + (Y#+25 - mY#)^2 + (Z# - mZ#)^2)<1000
X#=rnd(10000)
Z#=rnd(10000)
Y#= get ground height(1,X#,Z#)
If DecoCollide(X#,Y#,Z#) = 1
X#=mX#
Y#=mY#
Z#=mZ#
endif
EndWhile
Position camera X#,Y#,Z#
Point camera mX#,mY#,mZ#
Return
I would really like some help loading directx file levels, loading 3d guns, particles, and PLEASE GOD rapidfire. Thank you! You're my last hope!