Here Is The Code For A Basic Bullet...
Type This Into Your Control Code For The Bullet Creation...
If Spacekey()=1 And BulletAlive=0
Make Object Cube 10,4
Position Object 10,Camera Position X(1),Camera Position Y(1),Camera Position Z(1)
Rotate Object 10,Wrapvalue(Camera Angle X(1)),WrapValue(Camera Angle Y(1)),WrapValue(Camera Angle Z(1))
BulletAlive=1
BulletTime=0
Endif
Put This Code Near The End Of Your Main Loop To Control The Bullet...
If BulletAlive=1
BulletTime=BulletTime+1
Move Object 10,20
If BulletTime>25 Or Object Position Y(10)< Get Ground Height(1,Object Position X(10), Object Position Z(10))
Delete Object 10
BulletAlive=0
Endif
Endif
As For The Collision... Try Something Like This...
If Sqrt((Camera Position X(1)-Object Position X(2))^2+(Camera Position Z(1)-Object Position Z(2))^2)<8 Then Position Camera 1,XPrevious,Get Ground Height(1,XPrevious,ZPrevious),Zprevious
And To Vastly Improve The Performance Of Your Game, Place This At The Top Of Your Code...
...And This Right Above The "Loop" Command...
Sync
So Your Code Should Look Like This...
AutoCam Off
Sync On
gosub _load
gosub _camera
gosub _matrix
gosub _bunkers
gosub _gun
do
XPrevious=Camera Position X(1)
ZPrevious=Camera Position Z(1)
gosub _controls
Position camera 1,camera Position X(1),Get Ground Height(1, camera Position X(1),camera Position Z(1))+5,camera Position Z(1)
If camera Position X(1)<0 then Position camera 1,0,Get Ground Height(1,0,camera Position Z(1))+5,camera Position Z(1)
If camera Position X(1)>500 then Position camera 1,50,Get Ground Height(1,50,camera Position Z(1))+5,camera Position Z(1)
If camera Position Z(1)<0 then Position camera 1,camera Position X(1),Get Ground Height(1,camera Position X(1),0)+5,0
If camera Position Z(1)>500 then Position camera 1,camera Position X(1),Get Ground Height(1,camera Position X(1),50)+5,50
If BulletAlive=1
BulletTime=BulletTime+1
Move Object 10,20
If BulletTime>25 Or Object Position Y(10)< Get Ground Height(1,Object Position X(10), Object Position Z(10))
Delete Object 10
BulletAlive=0
Endif
Endif
Sync
loop
_load:
remstart load image "grass.bmp",1
load image "steel.bmp",2
load image ".bmp",3
remend
return
_camera:
make camera 1
position camera 1,50,50,50
return
_matrix:
make matrix 1,500,500,25,25
rem prepare matrix texture 1,1,1,1
randomize matrix 1,10
update matrix 1
return
_controls:
control camera using arrowkeys 1,.5,3
If Spacekey()=1 And BulletAlive=0
Make Object Cube 10,4
Position Object 10,Camera Position X(1),Camera Position Y(1),Camera Position Z(1)
Rotate Object 10,Wrapvalue(Camera Angle X(1)),WrapValue(Camera Angle Y(1)),WrapValue(Camera Angle Z(1))
BulletAlive=1
BulletTime=0
Endif
return
_gun:
Make object cylinder 1,10
XRotate Object 1,90
Fix object pivot 1
Scale Object 1,50,50,100
position object 1,12,-10,18
Lock object on 1
rem texture object 1,2
return
_bunkers:
make object cylinder 2,15
position object 2,100,0,100
rem texture object 1,3
return
I Hope You Understand All That Code. Its not fully tested, but I think it will work... Well... I hope I helped...
Programming isn’t an addiction, its more of a mental and social dependancy.