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 / Trouble with automatic shooting.

Author
Message
Silver Wolf276
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location:
Posted: 3rd Aug 2008 22:20
Hi everyone, me and my friend are having a problem.
I already have shooting implemented, but how would we do automatic firing?
I have done things like

Ok the problem with that code is, when I have 500fps the loop is going through very fast and I can shoot fast too.
But then I add particles and models, and FPS drops down to 40-60fps now the realodtime variable is increasing slower.
Does anyone have a better way for automatic shooting?
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 4th Aug 2008 03:56
You have 2 options:

1. Put SYNC ON and SYNC RATE (fps) at the top of your program (I recommend using 60, so you'd write SYNC RATE 60).

2. (a better but more complex option) Implement Timer Based Movement (or at least counting, anyway). You might do that like this:



For information on how to do timer based movement (which may be useful if you choose to use this method of reload counting), search the term on this forum to get lots of threads about it (or someone may respond with an example). I hope this helps

Silver Wolf276
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location:
Posted: 5th Aug 2008 03:11
Yeah I thought about Sync but then people with 20fps will take longer to shoot.
I didn't get on how to work with timers.
But your example does help.
Thank you, gonna go with timer hehe.
Silver Wolf276
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location:
Posted: 5th Aug 2008 03:28
Actually going to set Sync Rate because the gun gets faster every second.
Lol

Login to post a reply

Server time is: 2024-11-25 19:40:26
Your offset time is: 2024-11-25 19:40:26