making a time-dependent loadingbar

MartinRPMartinRP Member Posts: 6
edited August 2012 in Miscellaneous
Hey everyone. Im struggling with a loadingbar for my project. And i hope someone can help me out here!

I need to make a timer-dependent loadingbar, which means, that the user types in a random number. For example (10, 15 or 45) min. and dependent of that variable number, when the activity ends, the loading bar will be complete/filled out. And of course at the beginning the bar will be empty.

The loading bar is just a normal rectangular box.

The problem is that the bar will have to move differently according to what number the user types in.

At 1 min. the bar have to move much faster against the end, than if the number is 20 min. e.g.

And not matter if the number is 1, 20 or 45, when the time is up, the bar must be filled.

The bar must continually follow the timer. Which means that a timer set to 20. min, the bar will be half full at 10 mins.

does anyone know how to sole this in GS? I have searched the internet for tutorials, but unfortunately with no luck :(

Best regards, - Martin.

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited August 2012

    @MartinRP

    Hi Martin, one way is make a graphic of the rectangular outline, with transparency inside. Then make your actor with a solid colour, (lets call it LoadingBar) placed to the back of the rectangular shape. Set its height to the height of the rectangular outline, and its width to 0.

    Now make an integer attribute called LBTime for instance.

    So depending on how your loading bar is going to be triggered; let's assume it's with touch on a start button, after the user has inputted the time. (And here use a boolean, StartTime, false before the user has inputted a time, true afterwards). This inputted time is put into the attribute LBTime:

    When touch is pressed and StartTime is true
    Interpolate scene.Background.LoadingBar.Size.Width to --- max width of rectangle outline
    over LBTime seconds
    Interpolate scene.Background.LoadingBar.Position.X to --- middle of rectangle
    over LBTime seconds

    Hope that gives you a start.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.