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 / Shoot Bullets

Author
Message
CaMeRoN H
19
Years of Service
User Offline
Joined: 21st Aug 2005
Location: Who knows?
Posted: 28th Aug 2005 07:41
I looked at the tutorials on the monster hunt and i tryed to use their code for shooting. i use it except for the cyliner gun i use my own object. but the shooting wont work nothing comes out of the gun y?


Current Project: Stealth Operations (Fps)
SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 28th Aug 2005 08:49
Need to see the code you're using...

I can't see an easy way to without giving a massive big example on how I'm dealing with this problem myself. I'm using this (DBC can't intersect objects, so this way's more complicated):

(When mouse is clicked point gun left or right a random amount, and up a random amount, then create bullet as below (you'll need an object to use as a bullet though)


Variables used here:
CurrentWeapon -- the object number currently being used as the player's weapon
FreeBullet -- 9999 objects have been reserved for bullets, FreeBullet is the lowest possible number that's not already in use (The bullet you fire will be assigned to this object number)

(during each frame - move bullets... quickly, but one cell at a time)


Variables used here:
BulletNumber -- Identically numbered to FreeBullet. if a bullet has been assigned to this number it will be moved a set number of units in its current direction (Movement is determined by bulletspeed)
Bulletspeed -- how many units to move your bullet. So far it must be a whole number, 50 for example, would move your bullet 1 unit 50 times before moving onto the next one
Bulletdata -- is an array with data about the bullet, for movement purposes (x,2) determines "is the bullet free, or being used" (0 for in use, 1 for available (see next snippet))

(Code to decide which object number can be used as a bullet


Variables used here
Bulletavailable -- A third variables, again its range is only object numbers that an be used by bullets. once in the repeat section, it can't leave until it finds a bullet it can use. It uses bulletdata(x,2) to determine this. although it can have two values, you only need to test for one because the user can never set this value manually, it can only be one or the other.

Once it finds a number that isn;t being used, it esits the repeat cycle assigns FreeBullet (described above) the number it found to be free

Hope this helps - if it doesn't just wait... someone will know

...maybe one day I'll finish a project
Krimzon DestinE
19
Years of Service
User Offline
Joined: 18th Sep 2005
Location:
Posted: 31st Oct 2005 23:54

Login to post a reply

Server time is: 2024-11-27 14:42:56
Your offset time is: 2024-11-27 14:42:56