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 / Stamina Bar

Author
Message
TIGGER
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location: Somerset, England
Posted: 9th Mar 2006 19:18
I have a stamina code, that I have added into a 3D world.
It works as expected but continually flickers during gameplay.

Can anyone suggest how to prevent the flicker?
The thing that comes to mind is to use bitmaps and draw to front to overcome this problem.

Am I on the right track.

Any Help will be appreciated
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 10th Mar 2006 03:22
try and use the LOCK PIXELS command. i would need you to post your code if you wanted me to be sure.
Redostrike
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: Belgium
Posted: 10th Mar 2006 12:23
Let's see some code mabye you will get more help then.

Only heroes live forever.
Beatboxing Rulllllllllllzzzzzzzzzzzzz
www.redostrike.tk (Anime site trade availible)
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 10th Mar 2006 15:41
maybe youre updating the image every loop, when you really only need to if it has changed?

FREE Automatic file updates for your distributed Games and Apps - see Program Announcements Forum - DBP Demo
TIGGER
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location: Somerset, England
Posted: 14th Mar 2006 17:44
I appreciate the interest in this post, Sorry for the lack of posting any code.
Castle Rustler was right I was updating the image every loop, my father had a look at it and that was what the problem was.

Once again thanks everyone I hope we can converse again sometime.

Yours Sincerley

Tiggers Son
TIGGER
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location: Somerset, England
Posted: 14th Mar 2006 18:04
Doh, I 4got i do require some more help,
I am trying to get a gradual increase in my stamina bar when its depleated,
at the moment it just completley refills after 10 seconds or so. but i want to try and get to come back in bits, like in Battlefront 2 or wrestling games, etc.

Please help me
Hippie Dude
19
Years of Service
User Offline
Joined: 6th Feb 2005
Location: California, United States
Posted: 16th Mar 2006 02:34 Edited at: 16th Mar 2006 02:35
next time post your code like this

For your problem you could possibly do something like:

Be sure to put it inside your loop

Mysteries Surround You
Geo Kinkladze
18
Years of Service
User Offline
Joined: 8th Mar 2006
Location:
Posted: 16th Mar 2006 03:14
Tigger,

You could use the Time command as part of a calculation of the stamina increase.

Eg if you want to increase stamina by 1 per 10 seconds, and stamina last increased 20 seconds ago, stamina would increase by 2 or
(1/10)*20

Every time you increase the stamina pass the current time into a variable (eg lastinc) and then later, when you want to check when you last increased stamina, compare the current time to that variable. If it's less than 10 seconds, don't increase stamina, let the program carry on and do other things. Whenever it becomes 10 seconds or more... you let it increase relative to time passed.

This allows stamina to increase as a function of time. However I believe the real pros build "pulses" into games, say 20 pulses per second or so, and then everything is a function of the pulse. But I've no idea how that would work.
Kelebrindae
21
Years of Service
User Offline
Joined: 15th Sep 2003
Location: Where cheeses are scarier than dragons.
Posted: 16th Mar 2006 09:35
Hi Tigger,

In my current post from the 20-liners forum, there's an example of a stamina bar that gradually decrease according to the frame rate.
The bar is a 3D plain object (faster than a bitmap), and I think the code isn't too hard to understand (lots of comments). Not too fancy, but that's a start...

http://forum.thegamecreators.com/?m=forum_view&t=73205&b=11

Take a look, it might help...

Ideas: memories of things which did not occur yet...
http://keleb.free.fr/codecorner

Login to post a reply

Server time is: 2024-09-24 19:26:09
Your offset time is: 2024-09-24 19:26:09