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 / different bullets for different guns

Author
Message
steve c
21
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 23rd Feb 2004 16:21
can somone tell me how to make different ammo things for diferent guns like an ak-47=1:10 bullets and clips and a colt 3:9 somthing
like that and can you make it so it appears on the screen pls

*=========**=================*
*.-steve-.**.-slipknot rule-.*
*=========**=================*
Mark3D
22
Years of Service
User Offline
Joined: 29th Mar 2003
Location: United Kingdom
Posted: 23rd Feb 2004 17:50
hmm, this might sound stupid but if you are shooting bullets, they go sooooooo fast, there is no way u'll be ever see them while through the air.

just a thought

mark

Nature gave man 2 ends. One to think with, the other to sit on. Mans' sucess depends on which end he uses most!!
steve c
21
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 24th Feb 2004 22:01
i know but i want the person to reload after like 10 shots

*=========**=================*
*.-steve-.**.-slipknot rule-.*
*=========**=================*
BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 25th Feb 2004 06:25
Have a variable that stores how many bullets for whatever gun the player currently has in reserve, and another variable for the bullets of the same type that are loaded into the gun. Each time the player shoots a bullet subtract from the bullets that are loaded into the gun.
Once the variable representing ammo in the clip reaches 0 play a reloading animation, and subtract bullets from the variable representing the number of bullets in reserve according to how many fit in the clip. During your loop you can display this message with the various text commands available.

Crazy Donut Productions
Current Project: KillZone
steve c
21
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 21st Mar 2004 12:39
thanks but everything i trie goes wrong can somone give me a bit of code that stores the bullets and whatever

*=========**=================*
*.-steve-.**.-slipknot rule-.*
*=========**=================*
Don Malone
22
Years of Service
User Offline
Joined: 27th Apr 2003
Location: Birmingham, Alabama
Posted: 22nd Mar 2004 04:42
Your best design would be to use arrays.

Quick break down of how to use them would be like thinking through the game design.

1) How many different guns will be in the game?
2) What do you need to know about the guns
a) How many bullets can it hold (in one clip)?
b) Bullets left in active clip?
c) How many clips will you allow the player to carry?
d) Has this gun been picked up by (or available to) the player?
e, f, g, .....) You could track the each weapons range, accuracy, damage and what ever else you need but for the sake of argument I wont here and just use a,b,c and d as my tracking elements.

I would create an array for the five guns (just for reference) that I create and for each gun I will track four attributes so I will dimension an array like.

Dim Myguns(5,4)
dim UseWeapon as integer


And I will use the variable UseWeapon as the first element of my array when I need to check something.

I could also create some constants to make it easier to remember
and attach a matching number to each elemt but you can handle that yourself if you pay attention to the variable scope.

Gun 1 has a clip size of eight bullets (handgun), and the clip is missing one bullet leaving seven shells available before reloading, I can carry six clips counting the active clip and I have the gun already so if I need to make sure the select gun is available for my on screen character I would (simplified)

[/code]'I press the one key to use the handgun

if MyGun(KeyPressed,4) = 1 then
' change display of shell counter
' change display of active gun on screen
' change the variable (in my case) UseWeapon to keypress
end if


CheckActiveWeapon (KeyPressed,4)
[code]

If the return was false the active weapon is still on screen
You would also check amunition the same way just change the second element number in the array to point to the line containing active clip bullets as clips being carried.


I hope that helps a little.

Wasting CPU Cycles since the 286 was a hot machine.

Login to post a reply

Server time is: 2025-06-02 04:22:15
Your offset time is: 2025-06-02 04:22:15