Computer Science Canada

Different kind of progess bar

Author:  fear01 [ 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.

Author:  codemage [ Thu Dec 08, 2005 9:25 am ]
Post 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

Author:  ZeroPaladn [ Thu Dec 08, 2005 9:35 am ]
Post 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.

Author:  codemage [ Thu Dec 08, 2005 1:00 pm ]
Post subject: 

Umm...

lengh div 3
*is* rounded.

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

Author:  Saad85 [ Thu Dec 08, 2005 9:18 pm ]
Post 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.


: