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 / Speed consistency?

Author
Message
Databug
15
Years of Service
User Offline
Joined: 27th Oct 2008
Location: Elsewhere
Posted: 30th Mar 2009 00:19
Is there anyway i can controll the speed of my program? because in this program im making, the speed of the bullets arent consistant. depending on how many enemies there are, the bullets get slower. its hard to just paste code so ill enclose my program.

note:the sprites are very crappy, i know, just havent felt like making good ones yet XD

Attachments

Login to view attachments
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 30th Mar 2009 00:40
It's called time based movement. It allows your game to move things at a set distance per second, no matter how fast or slow the computer running it is. (within reason)

Paste this at the end of your program somewhere.


and add

global factor# as float
global Flast# as float

to your variable declarations section.

Inside your main loop add,

tm_Update()

Now when you go to move something, multiply the amount you're moving it by the factor#

move object PlayerObj, 10 * factor#

NOTE: If you don't have IanM's Matrix1Utils installed you can use timer() instead of hitimer() in the function.

Hope that helps.

Login to post a reply

Server time is: 2024-09-28 04:24:18
Your offset time is: 2024-09-28 04:24:18