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 / Bullet Questions

Author
Message
Frogon
20
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Kansas
Posted: 2nd Jul 2006 05:46


I stole almost all of that from the html tutorial that came with the DarkBASIC CD, and I went and modified a lot of it. One of the things I did was I moved the gun barrel from the middle of the screen, over to the right side (making it look like its being held right handed). I also went and changed where the bullet sphere comes from, however when you spin around the bullets dont always come out from where the end of the barrel is. When you're turned 180 degrees around from your starting position the bullets come out just about in the center of the screen, not 5 units to the right. I was wondering if there was another number that I had to change, or another variable I had to create to make it work while facing every direction?

My second question pertains to only being able to fire a single bullet until it dies (I did speed it up quite a bit, and lowered the life time). My initial idea was to create multiple bullets, hide them all, and after one was shot, it would cycle to the next one. However, I'm not too sure how the bullet life would work out.

Any help is appreciated, this is my first DarkBasic prog : )
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 2nd Jul 2006 11:09 Edited at: 2nd Jul 2006 11:10


This part says to position the bullet. But what you are trying to achieve is something else. With this code, the bullet will always be positioned - not depending on the camera's rotation - 5 units more than your X coordinate and 2 units less than your Z coordinate. If you rotate 180 degrees, right becomes left...

To solve this, we use trigometry. (sin and cos, or newx and newzvalue)

(The values are calculated to be positioned at 5 units left, 2 units before the player)
This doesn't work when rotating towards above. Some more calculations should be done then.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Frogon
20
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Kansas
Posted: 2nd Jul 2006 22:57
Ahhh, I understand that now, thanks for the help!!

However, I'm wondering, how did you come up with those value that you added to CameraAngleY#?
Briere
21
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 2nd Jul 2006 23:03
Also the bullet collisions may not always come up, because if you move the bullet 10 units each sync, and it passes through an object that is 8 units thick, it wont register.

Current Project: CTA Beta
Lines: 825
Last Updated: 6/30/06 at 7:21 PM EST.
Green7
20
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 2nd Jul 2006 23:08
is there a possiblity to come up collision always? cause a bullet with speed 10 is somehow slow... had this problem in a game made time ago. gave the whole game up as i noticed that half or more of my bullets passed through the walls, depending of how thick the wall was and what distance the bullet was shot. sad...

Frogon
20
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Kansas
Posted: 3rd Jul 2006 06:17
Could you possibly make it so that when it checks the bullet collision, it does a nested loop, checking all the units that it will move in the next sync?
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 3rd Jul 2006 16:43
The most simple way would be stretching your bullet. If your z-size equals the moving speed, then there shouldn't be any problems.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Green7
20
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 3rd Jul 2006 20:41
hah, good idea, have to try this! star for you if it works !

Frogon
20
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Kansas
Posted: 5th Jul 2006 00:13
Ok, I made the bullet longer, and now you cant shoot it through the corners of the boxes, which is really sweet. The only problem is that I'd like the bullet to end up hitting the center of the screen, just like a real FPS, however I dont really know how to get that to happen, while still having the gun off-centered. I was planning on making crosshairs just with lines on the screen, but it'd look funny if the bullet was shooting 5 feet to the right, or the crosshairs were off centered ; ( Is there any easy way to adjsut the bullet trajectory to always hit in the center, no matter how far it goes? (like, faking that it's shooting from off-center or something?)

Here's the longer bullet if you wanna mess with it:


I'm getting around to fixing the whole bullet shooting funny at different angles, and you being able to do backflips forever with the mouse : P
Edgel
20
Years of Service
User Offline
Joined: 5th Jul 2006
Location: U.S.A
Posted: 6th Jul 2006 21:15
This is a great tutorial. Tutorial 3.4 shows the bullet making process, and shooting.
http://developer.thegamecreators.com/?f=t01/3d_tutorial_index

The code it gives for bullet positioning



May not be what you're looking for, because it does have a gun in the center of the screen, but the position object co-ords are different then yours. If this stuff doesnt help you whatsoever... I'm a bit of a n00b with db.
Gamedesign er20
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: The one place you would never look...
Posted: 8th Jul 2006 02:05
Hey I've Been following that tutorial, and its good and all, but does anyone know how to make multiple weapons, like to start out with one and then press a button and switch to another

Login to post a reply

Server time is: 2026-07-07 22:22:30
Your offset time is: 2026-07-07 22:22:30