Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Different kind of progess bar
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
fear01




PostPosted: Wed Dec 07, 2005 10:00 pm   Post subject: Different kind of progess bar

I just read the other post about the progress bar, but i am looking for something similar to that. I want a progress bar for one of my games that would display three different types. The first would be a mistake bar, which would go up everytime the user gets a question wrong. There is a three incorrect limit and was wondering how i could incorperate that into the loop. Therefore everytime someone gets an answer wrong, the bar would go up by 33.3 percent. Then it would cls the screen and exit. I was wondering how I could do this. The other two types the other post has cleared for me. Thanks for the help in advanced.
Sponsor
Sponsor
Sponsor
sponsor
codemage




PostPosted: Thu Dec 08, 2005 9:25 am   Post subject: (No subject)

Draw a box (rectangle) with Draw.FillBox
It's length is definied by a variable.
Your variable is influenced by how many questions you have wrong:

0 wrong = maximum size
1 wrong = (maximum size ) div 3, * 2
2 wrong = maximum size div 3
3 wrong = exit
ZeroPaladn




PostPosted: Thu Dec 08, 2005 9:35 am   Post subject: (No subject)

if your using graphics you might want to round...

example
code:
% for 66.6%
var lengh : int := 100
Draw.FillBox (0, 0, round ((lengh div 3)* 2), 50, kolor)


just an idea.
codemage




PostPosted: Thu Dec 08, 2005 1:00 pm   Post subject: (No subject)

Umm...

lengh div 3
*is* rounded.

"div" is integer division - so you won't ever get decimals.
11 div 2 = 5
Saad85




PostPosted: Thu Dec 08, 2005 9:18 pm   Post subject: (No subject)

or you could go something like this.

set a variable and make it go up by 1 every time they get something wrong

Quote:

var mistakes:int %find a way to increse it when they get something wrong.

% set a for loop to make a portion of then bar every time they get something wrong
for i:1..mistakes
if i>=1 then
drawfillbox (maxx div 3 * (i-1), maxy div 10-10, maxx div 3 *i, maxy div 10+10, red)
end if
end for




this program (once you fit into a proper code) will make a bar on the bottom 1/10th of the screen. this way, if you ever implement a way to decrease the amount of mistakes they have (powerup) then it is simple, just decrease the variable mistakes and it will handle itself.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: