http://adarkroom.doublespeakgames.com/
There's a button on screen. If the player clicks it, a bar appears and takes x amount of time to fill up. When the bar is full, something happens and the bar disappears.
I want multiple buttons on the screen. The player can click on multiple buttons. That means multiple bars showing up on the screen all getting filled at different rates. I figure the best way to do this is have a 'for' loop, use a class/list/dictionary/something to store all the data, and have it 'use' a screen only containing the bar. No problem. The problem I'm having with this is that once the player clicks the button, the bar (using AnimatedValue) remains filled.
How would I reset the bar so the value stored is 0 again?
I figured out I can get it to reset by showing and hiding the screen, but it looks really clunky and needs me to make multiples of the same screen. Not to mention I'll have to position it manually instead of having the bar nestled right next to button in an hbox...
What I have so far:
Code: Select all
screen baking():
frame:
align (0.05, 0.05)
xpadding 10 ypadding 10
xfill True yfill True
xysize (150, 200)
vbox:
textbutton "Bread" action [Show("bread_bar", time=3, text="Baked Bread!", hide_screen="bread_bar")]
textbutton "Cake" action [Show("cake_bar", time=10, text="Baked Cake!", hide_screen="cake_bar")]
screen bread_bar(time, text, hide_screen):
use item_bar(time, text, hide_screen)
screen cake_bar(time, text, hide_screen):
use item_bar(time, text, hide_screen)
screen item_bar(time, text, hide_screen):
timer time action [ItemLog(text), Hide(hide_screen)]
bar value AnimatedValue(200, 200, time, 0): # This here?
xysize (200,25)
thumb None
Thanks so much for your time! :)