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 / Decrementing Ammo

Author
Message
CaMeRoN H
19
Years of Service
User Offline
Joined: 21st Aug 2005
Location: Who knows?
Posted: 30th Aug 2005 04:01 Edited at: 30th Aug 2005 04:03
ok heres the code

and

it wont subtract 1 every time i click it just stays at 30 y?
EDIT: it will subtract now but it goes too fast like when i press once it goes to like -300 y?


Current Project: Stealth Operations: Release Date: September
thinkdigital
20
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 30th Aug 2005 04:15
Quote: "but it goes too fast like when i press once it goes to like -300 y?"


The game loop goes incredibly fast. What you need to do is set a timer after decrementing it once, so that it will pause for at least a second for every time it decrements. Tell me how this code works:



CaMeRoN H
19
Years of Service
User Offline
Joined: 21st Aug 2005
Location: Who knows?
Posted: 30th Aug 2005 05:01
still does the same thing


Current Project: Stealth Operations: Release Date: September
CaMeRoN H
19
Years of Service
User Offline
Joined: 21st Aug 2005
Location: Who knows?
Posted: 30th Aug 2005 07:06
Come on i need some support on these forums these days....


Current Project: Stealth Operations: Release Date: September
master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 30th Aug 2005 08:38
In your code I think you have it decrement the value of ammo even when you don't fire. I think it should be like this:

I believe strongly that that should work. If that doesn't work, make/remake a delay like thinkdigital said, but, add it too the bullets as well

poisoned
19
Years of Service
User Offline
Joined: 6th Jun 2005
Location: the shadow realm
Posted: 30th Aug 2005 08:39
here is how i went about it in my shoot out game. Hope this helps





media:
http://batbusters.us/seik/shoot-out.zip

Intel P4 3.6Ghz 1G PC3200 DDR
master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 30th Aug 2005 08:41
I don't think the entire code was necessary, maybe only the shooting part

poisoned
19
Years of Service
User Offline
Joined: 6th Jun 2005
Location: the shadow realm
Posted: 30th Aug 2005 08:56

no, no ... This is just code i copy and pasted from another one of my posts, from a while back, I don't need the code and do not have the time to root through it! if he really needs it he can easily find it.

Intel P4 3.6Ghz 1G PC3200 DDR
master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 30th Aug 2005 09:01
OH, OK then.

Also, you may want to add something like if ammo>0 so that it makes it so you can't fire when you don't have any ammo

The admiral
22
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 30th Aug 2005 12:28
you need a variable you set like this.


Thats just a rough idea and will only work for one bullet at a time.

The admiral
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 30th Aug 2005 14:50 Edited at: 30th Aug 2005 14:51
No I know where the problem is:

When you click and your bullet is in mid-air, the explosion hasn't even begun! So this means the variable will decrement because the explode variable = 0 and the mouse is clicked.

Here's the correct code:


I hope it'll work now.

Immunity and Annihalation makes Immunihalation...
CaMeRoN H
19
Years of Service
User Offline
Joined: 21st Aug 2005
Location: Who knows?
Posted: 30th Aug 2005 16:36
ok well heres like half of my code tell me wats wrong

it just wont show it being subtracted on the hud


Current Project: Stealth Operations: Release Date: September
CaMeRoN H
19
Years of Service
User Offline
Joined: 21st Aug 2005
Location: Who knows?
Posted: 30th Aug 2005 16:53 Edited at: 30th Aug 2005 16:53
OMG i remember having this prob b4 its because ammo = 30 was in do loop so no matter what its gonna be 30.
so i had it right the whole time.
i cant believe something that easy i just thought of. thanks for helping though guys.


Current Project: Stealth Operations: Release Date: September
thinkdigital
20
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 30th Aug 2005 22:57
I am so sorry, I did that less than sign as a greater than sign. Here you go:

CaMeRoN H
19
Years of Service
User Offline
Joined: 21st Aug 2005
Location: Who knows?
Posted: 31st Aug 2005 09:14
ok thanks i got it now.


Current Project: Stealth Operations: Release Date: September

Login to post a reply

Server time is: 2024-09-24 03:18:35
Your offset time is: 2024-09-24 03:18:35