Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Relitivley new to Darkbasic, need help

Author
Message
DB9K
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location: United Kingdom
Posted: 3rd Jan 2003 14:10
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)
DB9K
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location: United Kingdom
Posted: 3rd Jan 2003 15:01
text 240,220 ,"hit hit hit hit hit hit hit hit"
endif

If BulletLife = 0
Hide object 2
Stop sound 2
Endif
Endif

Yrotate camera CurveAngle(CameraAngleY#,OldCamAngleY#,24)
Xrotate camera CurveAngle(CameraAngleX#,OldCamAngleX#,24)

Y# = Get ground height(1,X#,Z#)
Position Camera X#,Y#+50,Z#

Rem Refresh Screen
Sync
Loop

Sorry, I missed that code out.

Inkybro
21
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Where I live :)
Posted: 3rd Jan 2003 18:19
I don't have DarkBASIC yet but I do read he posts here and I'm amazed at the kindness of everyone here. If you're confused do NOT hesitate to ask.

Another thing. I'm sure you're going to think "What an idiot, a KNOW IT ALL!" but really I'm not trying to be. Unless you have other programming experience I wouldn't start by programming a game, maybe do the tutorials or do small stuff. I actually have some rusty programming knowledge in QBasic (very like DB) and I've been practicing it to be better at DB.

Anyway, the best of luck to you!

-Ethan
http://www.wizardduels.com
AIM: WizardDuelsHelp
MSN: FantasyDrawer123321@hotmail.com
Yahoo: Wizfen

DB9K
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location: United Kingdom
Posted: 3rd Jan 2003 18:30
Thank you for your kind response I do have slight experience in coding, but not of the game type, Just visual basic stuff like calculators and notepads. But thanks anyway
I hope someone can solve my problems though

John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 3rd Jan 2003 22:47
To add the object on the gun- try ADD OBJECT LIMB, or other commands.

RPGamer

Current - RPG: Eternal Destiny : Help Wanted!
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy!
DB9K
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location: United Kingdom
Posted: 4th Jan 2003 16:16
Thanks! Great, that really worked for me! Thanks

Login to post a reply

Server time is: 2024-03-28 20:42:43
Your offset time is: 2024-03-28 20:42:43