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 / cylinder gun

Author
Message
Lost Kid
20
Years of Service
User Offline
Joined: 16th Feb 2005
Location: Usa
Posted: 17th Feb 2005 09:25
can anyone tell me how to create a shootable gun useing a cylinder and for the bullets a sphere? thanks
Unseen Ghost
22
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Ohio
Posted: 17th Feb 2005 11:43
Hi,

There is an excellent tutorial on the DarkBasic site. Go to the tutorials and code link and click the link to the 3D Monster Hunt tutorial. It will show you how to do exactly what you want.

Unseen Ghost
Lost Kid
20
Years of Service
User Offline
Joined: 16th Feb 2005
Location: Usa
Posted: 17th Feb 2005 14:32
I'm using the same script as the on-line tutorial but, when I go to shoot the gun the bullet dosn't come out, why?
Unseen Ghost
22
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Ohio
Posted: 18th Feb 2005 09:24
I remember that back when I went through the tutorials I learned a lot that is why I said they are excellent. But I did find some mistakes along the way in the code. I had to post code from the tutorial also to get some help. It has been a long time since I went through the tutorial. It would be easier for someone to help if you would post some code.

Unseen Ghost
Zero #43
21
Years of Service
User Offline
Joined: 5th May 2004
Location: ** in your head **
Posted: 18th Feb 2005 09:32
i can make a 3d model, and animate it if u want, just tell me wut to make, and hopefully i can find a picture of it. just in the credits, include me as a modeller

Zero #43
Zero #43
21
Years of Service
User Offline
Joined: 5th May 2004
Location: ** in your head **
Posted: 18th Feb 2005 09:36
i got a paintball gun made and animated if u want it? .x format

Zero #43
Lost Kid
20
Years of Service
User Offline
Joined: 16th Feb 2005
Location: Usa
Posted: 18th Feb 2005 09:39
here is the code i'm using, if it helps

rem Make Gun
Make object cylinder 1,2
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
Hide Object 2

if Mouseclick()=1 and BulletLife=0
Position object 2,X#,Y#+43,Z#
Set object to camera orientation 2
BulletLife =25
Show object 2
Endif

If BulletLife > 0
Dec BulletLife
Move object 2,20
If BulletLife = 0 then Hide object 2
Endif

No thanks zero #43 i'm still a little new in darkbasic, thanks anyway
Lost Kid
20
Years of Service
User Offline
Joined: 16th Feb 2005
Location: Usa
Posted: 18th Feb 2005 12:18
actually Zero#43 I Could Use That Paintball Gun
Can you post it to download?
Unseen Ghost
22
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Ohio
Posted: 19th Feb 2005 10:37
Does your straffing code tutorial code work right ? It's the tutorial right before the bullet one. I seem to remember having a problem with the straffing code when I did the tutorial, but I got it fixed. The only thing I can come up with right now is that there is the x# and y# variables that are in the straffing code and also ing the bullet tutorial. Since I had to totally redo the straffing code the bullet code doesn't match up.
Sorry about the novel I typed. When I get to talking, I seem to never shut up.

Unseen Ghost
Lost Kid
20
Years of Service
User Offline
Joined: 16th Feb 2005
Location: Usa
Posted: 19th Feb 2005 11:16
the straffing tut don't work, well, i mean it runs w/o any errors but when i go to try and straff the camera dosn't move
Unseen Ghost
22
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Ohio
Posted: 19th Feb 2005 22:20
This is the code someone gave me for straffing a long time ago. See what you can do with it.

rem Strafe left
if leftkey()=1
yrotate camera wrapvalue(camera angle y()-90)
move camera 10
yrotate camera wrapvalue(camera angley()+90)
endif

rem Strafe right
if rightkey()=1
yrotate camera wrapvalue(camera angle y()+90)
move camera 10
yrotate camera wrapvalue(camera angel y()-90)
endif

Unseen Ghost
Lost Kid
20
Years of Service
User Offline
Joined: 16th Feb 2005
Location: Usa
Posted: 20th Feb 2005 03:57
Thanks For This Strafe Code Unseen Ghost It Actually Works But I Do Have One Slight Question, How Does This Effect The Way The Bullets Shoot?
Unseen Ghost
22
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Ohio
Posted: 20th Feb 2005 09:04 Edited at: 20th Feb 2005 09:08
Did you get your gun to shoot properly yet ? I was looking through the tutorial myself to see if I could remember if there was an error in the bullet tutorial. Then I saw that the walking forward, and backward and the straffing code had some of the same variables. The program has to know where you are on the matrix and which way you are facing so the bullet can go in the right direction. If the code to the walking is wrong the bullet probably won't work either. I thought that might have something to do with it, but I could be wrong.

It has been about 1 1/2 years since I have done the 3D Monster Hunt tutorial. If your gun is still not shooting either you mistyped some of the code or there is another error other than the straffing.

Another novel. Hee! Hee!

Unseen Ghost
Lost Kid
20
Years of Service
User Offline
Joined: 16th Feb 2005
Location: Usa
Posted: 20th Feb 2005 11:50
Download the code i'm using you might find somthing wrong in it that i dont know of
[img]E:\ball.bmp[/img] [img]E:\floor1.bmp[/img]

Attachments

Login to view attachments
Unseen Ghost
22
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Ohio
Posted: 20th Feb 2005 22:57
Hey,

I just wanted you know Lost Kid I'm still helping you. I have been working on your code. I have redone added some code. I still can't get the gun to shoot, but I should have it working soon. I thought you might want to look at what I have so far. Here's the code.

Unseen Ghost
Unseen Ghost
22
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Ohio
Posted: 21st Feb 2005 04:53
Ok,

I got the bullet to shoot. It shoots every time you press the mouse button, but if you move you will notice that the bullet comes from the same spot on the matrix. And if you shoot on the move the bullet goes wacky.

At least I was able to get that far.
I don't know what version of windows or DarkBasic Classic you are using, but I never had to use get image command to texture a matrix.
Of course it could have been my computer.

I have always created my matrix before other objects.
Why you had to raise the camera on y axis 200 to be on the matrix I couldn't figure out. I tried everything I could think of.

Maybe you can play with this code to get it to work better for you.
Hope this helps.

Unseen Ghost
Lost Kid
20
Years of Service
User Offline
Joined: 16th Feb 2005
Location: Usa
Posted: 21st Feb 2005 08:38
Quote: "I don't know what version of windows or DarkBasic Classic you are using"


well, my computer is a microsoft windows me, and to tell you the truth i don't own a full version of dark basic(yet) i ordered a game creation kit, and the cd had a dark basic trial version w/o a trial so it means i can't create stand alone exes but i have the software forever(This really bummed me)

Quote: "Maybe you can play with this code to get it to work better for you.
Hope this helps"


Nope i can't get the code to work any better than you can, but it has helped so thanks

And(If you have read this far) i was wonderin' if its possible to make the sphere like a hidden 3d character that follows along with the camera(using directional keys like the camera) until the player shoots.

thanks for reading, and thank-you
Unseen Ghost
22
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Ohio
Posted: 21st Feb 2005 11:22
Your welcome,

I have the 1.13 full version of DarkBasic Classic and I have Windows XP.

Yes you should be able to do that. I would hide your character just like you did with the bullet, the hide object should work. Track the x,y,z coordinance of the object where it would be on the matrix and detect when the mouse clicks then show the character(object) as you shoot.
That is a rough draft of it, but it should work.

Glad I could help

Unseen Ghost

Login to post a reply

Server time is: 2025-05-23 19:40:37
Your offset time is: 2025-05-23 19:40:37