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 Professional Discussion / Intersect Object command...

Author
Message
MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 23rd Jun 2003 13:44
After realizing that simply moving the bullet and checking for collision once, twice, or even three times in a loop still won't register collision, I decided to use Intersect Object and the collision code (just because I was afraid I would break the code if I took the bullet collision code out). However, I cannot get intersect object to work at all.

Even in the help description Intersect Object it said to be ideal for bullet calculations. I have included the subroutine in which I use Intersect Object. Can anyone figure out what is going wrong?
MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 23rd Jun 2003 14:02
I just realized that I am using it with three different values three different times in the program. However, I don't think this would change anything.

My friends' and my website for DBPro Programming:
http://unseenstudios.coolfreepages.com
Dreamora
23
Years of Service
User Offline
Joined: 20th Sep 2002
Location: Switzerland
Posted: 23rd Jun 2003 16:49
This prog will be deadly slow with for next within the main routine

why do you calculate between moving points?
take starting point and an endpoint outside the matrix range and then use intersect on this line. it will return the nearest collision to startpoint.

MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 24th Jun 2003 04:12
I'm trying that, but it doesn't seem to be working. I have posted the updated code (after taking out all kinds of unnecessary stuff).

My friends' and my website for DBPro Programming:
http://unseenstudios.netfirms.com
MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 24th Jun 2003 08:36
I am now on a deadline of 5 more days. Does anyone know anything else? Maybe a different way to implement bullets?

My friends' and my website for DBPro Programming:
http://unseenstudios.netfirms.com
Flashing Blade
23
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 24th Jun 2003 12:24
I only had a quick read but you doing an intersct between bullit and object rather than bullit and bullit destination.
You wanna store the angle of the bullit when it's fired and then each time you use intersect project you intersect line from bullit to where the bullit will be in that loop.

Heres an example i did a while ago:

The intersect is at line 80 (change bullit speed at line 76).
TheCyborg
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Denmark
Posted: 24th Jun 2003 19:12
You could just use Instant bullets. When the gun is fired move the bullet object from the tip of the gun and forward one unit at a time and check for collision. When the bullet hits you can exit the loop and continue the main game loop. This is actually faster than it might sound, even if you are using a machine gun, because a machine doesn't shot every frame.


pseudocode:




Not up yet --> http://thecyborg.sytes.net/

Login to post a reply

Server time is: 2026-07-17 19:32:57
Your offset time is: 2026-07-17 19:32:57