Hello! I'm new to these forums, and I'm sorry if I sound stupid, but I'm new to darkbasic (Although it already is a great program for me), and I've been making my own game. But I've been a bit confused, and things have been acting strangley, But I want to know a few things. Do you think you could help?
The things I've been wondering about are:
_________________________________________
1) How would I attach another shape to my cylinder gun? I'm not quite sure about how to do it. I want to attach a square to the side of the cylinder.
Here is the code for my gun:
Rem Make Gun
Make Object Cylinder 1,2
Color Object 1,RGB(50,50,50)
XRotate Object 1,90
Fix object pivot 1
Scale object 1,100,100,500
position object 1,0,-7,15
Lock object on 1
But I don't understand what to do If I want to add more on.
2)To make the shooter a bit more realistic, I made the gun go to the right hand side of the screen, giving a 'Gun held in right hand' kind of view. This was done by setting the position of the gun to 1,+10,-7,+10, But if I do the same for the bullet, It initally positions the bullet in the right place, but if I rotate the camera, it slowly moves away from the gun and fires in a different position, which is annoying.
3) Is there any way to increase the firing rate of my gun?
4) How can I decrease or increase my moving speed?
Thats all I need to know for now. Thanks in advance for your replies!
By the way, Here is the full code for my game.
Rem *********************
Rem * Gunner by DB9K *
Rem *********************
Sync On
Sync Rate 30
Hide mouse
Backdrop on
Set camera range 1,5000
Fog on
Fog distance 4000
Fog color RGB(142, 45, 128)
Rem make matrix
Make matrix 1,10000,10000,20,20
Rem texture matrix
Load image "Pave05.bmp",1
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1
Rem Randomize the matrix
Randomize matrix 1,125
X#=5000
Z#=5000
Rem Load Target
Load object "idle.x",3
X#=5000
mY#= Get Ground Height(1,5000,5500)-1
mZ#=5500
Position Object 3,5000,mY#,5500
Rem Make Gun
Make Object Cylinder 1,2
Color Object 1,RGB(50,50,50)
XRotate Object 1,90
Fix object pivot 1
Scale object 1,100,100,500
position object 1,0,-7,15
Lock object on 1
Rem Make Bullet
Make Object Sphere 2,2
Color object 2,RGB(255,0,0)
Hide Object 2
Rem Sounds for planet and gun
Load sound "Voidhum.wav",1
Load 3Dsound "Thump.wav",2
Loop sound 1
Rem Main loop
Do
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
CameraAngleY# = WrapValue(CameraAngleY#+MousemoveX()*0.2)
CameraAngleX# = WrapValue(CameraAngleX#+MousemoveY()*0.2)
Rem Control input for camera
If Upkey()=1
XTest# = Newxvalue(X#,CameraAngleY#,10)
ZTest# = Newzvalue(Z#,CameraAngleY#,10)
If XTest#>0 and XTest#0 and ZTest#0 and XTest#0 and ZTest#0 and XTest#0 and ZTest#0 and XTest#0 and ZTest# 0
Dec BulletLife
Move object 2,20
bX#=Object position X(2)
bY#=Object position Y(2)
bZ#=Object position Z(2)
Position sound 2,bX#,bY#,bZ#
set cursor 10,10
print Sqrt((mX# - bX#)^2 + (mY#+25 - bY#)^2 + (mZ# - bZ#)^2)
if Sqrt((mX# - bX#)^2 + (mY#+25 - bY#)^2 + (mZ# - bZ#)^2)