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 / Help, FPS bullet collision and other needed things

Author
Message
CornStalks
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location: Utah
Posted: 4th Jul 2004 10:53
Hey guys, I am using DarkBasic currently, and I like it. I'm making a FPS right now, and I can get just about everthing to work, exept the bullet collision. I can get it to work if I move the object slowly, but if I move the object at the speed I want it to go, it will just skip right through the target. Is there anyway that I could make this work? Even if I used sprites or something? Anything?

P.S.
I keep seeing this DarkBasic Clasic stuff, but all I know of is DB. Where can I find DBC? If you need the code I am using, just ask.

dang im hot...
Hop a long
21
Years of Service
User Offline
Joined: 12th May 2004
Location: The Code Dump
Posted: 4th Jul 2004 13:16
Can we see some code?
Balid
21
Years of Service
User Offline
Joined: 21st Nov 2003
Location: MI, USA
Posted: 4th Jul 2004 14:33 Edited at: 4th Jul 2004 14:35
Better Off Dead,

If your not using Dark BASIC Pro then your using Classic .

As for your first question, I move my rounds one unit at a time and use a for-next loop to move them at the speed I want. If I want my rounds to move at 15 units each cycle then I set my for-next to loop 15 times and I check if the round is below ground or has hit an object each loop.

Hope that helps


[edit] can anyone see my signiture tag??? (not that its really good)

Axelman
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location: Parallel Universe
Posted: 5th Jul 2004 22:23 Edited at: 5th Jul 2004 22:29
well with bullet collision this is what i would do.


Of course, there is still heaps more stuff you need to do, and i'm not sure it that shooting stuff would work but if it does tell me.
Anyways, Goodnight and GoodLuck.
Axelman

CURRENT PROJECT: Enemy At The Gates
CornStalks
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location: Utah
Posted: 6th Jul 2004 02:11
K, Here is the code I am using. I didnt include the load object and that stuff, but object 1000 is the bullet and object 2 is the com. It is pretty simple, and thats probly why it doesnt work. Thanks you guys, I'll try your stuff out.

@ Balid:
I think I understand what your saying. You mean that you have your bullet move 1 unit 15 times a loop basically, right? Cause now that I see that it makes sense. Oh, and I can't see your signature tag.

dang im hot...
CornStalks
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location: Utah
Posted: 6th Jul 2004 02:16
umm, I can't see the code i just put, ill put it again...

incase it does it again, ill just copy it to here too...

`this takes the bullet away if it hits the ground
bullx=object position x(1000)
bullz=object position z(1000)
bully=object position y(1000)
hitground=get ground height(1,bullx,bullz)
if bully<hitground
antishoot=0
hide object 1000
position object 1000,20,2000,20
hide sprite 19
endif

rem shoot
`this is where you shoot the bullet
if mouseclick()=1 and noshoot=0 and antishoot=1
position object 1000,cx#,cy#,cz#
show object 1000
set object to camera orientation 1000
noshoot=waiting
antishoot=0
show sprite 19
gosub shoot
endif

rem noshoot
`this makes sure you can't shoot your sniper and pistol like the machine gun
if noshoot>0 and antishoot=0 then gosub shoot
if noshoot=0
antishoot=1
hide object 1000
position object 1000,20,2000,20
endif

rem bullet hits com
`this is where the com dies
comdie:
z=rnd(2)+1
killcom=object collision(2,1000)
if killcom=1
hide object 1000
position object 1000,20,2000,20
texture object 2,z
endif
return

Rem Refresh Screen
Sync
position mouse 320,240
Loop

rem bullet shot
`this is where I am having my troubles
shoot:
move object 1000,100
dec noshoot
return

dang im hot...
CornStalks
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location: Utah
Posted: 6th Jul 2004 02:41
Thank You so much Balid, I just used your idea and now it works everytime! I will be sure to include you in the thank-yous. And for everybody else that might have these problems, I'm gonna put the code here.


Ignore all the crazy stuff in there, I just copied it. Basically what it says is that when you shoot the bullet, it will move it 1 unit. By having the For fire=1 to 100 and Next Fire, it will move the bullet 1 unit at a time, but still move it extremely fast. You have to put the code that is used when the bullet hits the computer in the For Next command area, otherwise it won't work. Thanks again Balid!

I just changed my Forum stuff, I was once better off dead, but I prefer candy than death.

dang im hot...
Balid
21
Years of Service
User Offline
Joined: 21st Nov 2003
Location: MI, USA
Posted: 6th Jul 2004 03:17 Edited at: 6th Jul 2004 03:23
32 Melted Gummy Bears,

Your welcome. I'm glad it was helpful.

I like your new Nick over your old one .

Balid
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 6th Jul 2004 04:44
@32 melted gummy bears, your code was included in your posts, look at the little button marked "source" next to your profile button at the bottom of your posts.....click it

Mentor.

PC1: P4 hyperthreading 3ghz, 1gig mem, 2x160gig hd`s, Nvidia FX5900 gfx, 6 way surround sound, PC2: AMD 1.2ghz, 512mb ram, FX5200 ultra gfx, stereo 16 bit soundblaster.

Login to post a reply

Server time is: 2025-05-24 23:09:57
Your offset time is: 2025-05-24 23:09:57