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.

Newcomers DBPro Corner / How to shoot

Author
Message
Hippie Dude
19
Years of Service
User Offline
Joined: 6th Feb 2005
Location: California, United States
Posted: 4th Sep 2005 19:54
I've tried many things for my player to shoot in his 3d enviorment. Can anyone post some base code?

Mysteries Surround You
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 4th Sep 2005 20:10
I'm not gonna give you the code, just gonna show you how.

First you have to determine the trigger - wether it will be the spacekey or mouseclick or something. If this is an FPS, it's probobly better to do a mouseclick trigger.
So in the main loop, your gonna have to have-


Instead of having a gosub, lets just use a simple variable.

The variable will be called trigger#

So we should be able to set the trigger# variable to it's shooting state by having this code-


We don't want to have the trigger# variable be in shooting state all the time, so we have to add this code-


Now that we have the trigger set to shooting we are going to have make the bullet.

Also in the loop, we are going to have to identify if the trigger# variable was set to shoot. So we will have to have-


And now that we have the trigger done, its time to look at the properties of the bullet we will have.

First, it's size. So the command will be-


You will have to replace the objnum, with the number of of the object the bullet will be, and sizenum, with the size of the bullet-cylinder. Find a comfertable size for the character's weapon.

So the code so far is (in the loop)-


I'm busy right now, so the rest of the stuff will come later

Hope it helped!
Hippie Dude
19
Years of Service
User Offline
Joined: 6th Feb 2005
Location: California, United States
Posted: 4th Sep 2005 20:14
thanks so far Xenocythe!

Mysteries Surround You
Deep Thought 42
19
Years of Service
User Offline
Joined: 31st Jul 2005
Location: New Jersey, USA
Posted: 6th Sep 2005 16:24 Edited at: 6th Sep 2005 16:24
Are you using DBPro or DBC?

"Winners never quit and quitters never win. But those who never win and never quit are idiots."
Hippie Dude
19
Years of Service
User Offline
Joined: 6th Feb 2005
Location: California, United States
Posted: 10th Sep 2005 01:36
I'm using DBpro.

Mysteries Surround You
Hippie Dude
19
Years of Service
User Offline
Joined: 6th Feb 2005
Location: California, United States
Posted: 10th Sep 2005 01:46
Please somebody help!

Mysteries Surround You
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 10th Sep 2005 02:13 Edited at: 10th Sep 2005 02:13
Oh... DBPro.. sorry, I use DBC, and why dont you check out the monster hunt tuorial??? Or even "The newcomers guide to create a first person shooter" ??
Crazy Programmer
AGK Developer
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Lost in AGK
Posted: 10th Sep 2005 15:07

thats should work

Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 10th Sep 2005 22:55
NOOOOOOOOOOOOOOOOOOOO!!!

Why do people create objects when they're shooting?

Creating objects for shooting for anything other than like a rocket launcher is ridiculous. It uses up resources, you have to keep track of all kinds of object numbers to make sure you don't overlap anything. There is a great way to do this in DBPro that is the intersect object command. Look it up.

As for DBC look at the newcomer's guide to creating first person shooters because it also goes into a detailed explanation of a way to simulate the intersect object command.

Formerly known as SFLM.
Hippie Dude
19
Years of Service
User Offline
Joined: 6th Feb 2005
Location: California, United States
Posted: 11th Sep 2005 01:58
thanks guys

Mysteries Surround You
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 12th Sep 2005 01:34
You could oh gee i dunno go to the code base? That sounds like a good idea too me.

When we talk to god, we're praying. When god talks to us, we're schizophrenic.
Fortune never calls on those that have no balls.
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 12th Sep 2005 01:56
When looking into the intersect object command check out Sparky's dll...it really is a lifesaver, incredably accurate and very fast.
Works on DBC too if your version supports dlls.

Jerok
19
Years of Service
User Offline
Joined: 7th May 2005
Location: Mars. Wait a sec I\'m on MARS. OMG
Posted: 12th Sep 2005 06:43
look at ruccus's fps tutorial itll help
Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 12th Sep 2005 20:13
Hi, im using DBP. I am also coming to the point were i need to make a shooting action. I need to make a rocket from an aero plane fire off, i have them as seperate .x files and also a machine gun which needs to be used, but i need it shooting a cross hair. Can anyone offer any advice plz?

Thanks.

http://www.Bevansfunbox.com

Login to post a reply

Server time is: 2024-11-27 18:49:59
Your offset time is: 2024-11-27 18:49:59