how do i add value to my progress bar

0 favourites
  • 10 posts
From the Asset Store
Progress\Loading Bar. Now Load you game like a Professional.
  • hi!

    i have a progress bar in my game and im trying to make it so that every time you collect a gem the progress value +1. so far i have set the maximum value to 4, (there are only 4 gems so far) and when the player collides with the gem, the gem destroys and now i need to make the progress value +1. i tried making an instance variable called progressvalue, and when the player collides with the gem the progressvalue variable adds +1 value. i was wondering if i could now connect the instance variable value to the progress bar value, if that makes sense.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hey there, it's perfectly possible, but the method will likely depends of what your progress bar will look like, will it be a simple rectangle or does it have more visual details? If you could post a screen of the result you want that could help ~

  • ty for helping! it is just a grey rectangle

  • ty for helping! it is just a grey rectangle

    i cant add a screenshot

  • In that case, you just need a grey square sprite, put its origin on the left, then decide what should be its width for one gem and multiply it with your variable, for example if one gem = 10 pixels width, Everytick > Bar : Set width to 10*Variable

  • thankyou so much! i will try it out

  • I made you a quick tutorial video for creating a progress bar:

    youtu.be/FM0uJ0g7ueY

  • i will try it out

    thanks

  • I made you a quick tutorial video for creating a progress bar:

    https://youtu.be/FM0uJ0g7ueY

    its great thankyou!

  • I make progress bars this way:

    - progress bar itself is tiled background - it lets to avoid stretching texture when you change its size, instead it's "revealing" texture.

    - progress bar has set starting point horizontally - left, vertically - center. So it will "grow" from left to right.

    - I create two constant variables: one for max bar width (or length) and one for max value that you bar is representing. Ex: max_bar_width = 100, max_lifes = 10.

    - then I calculate bar width:

    set bar.width = floor(current_lifes/max_lifes * max_bar_width)

    - you can show values for progress bar over it as text:

    set text = current_lifes & "/" & max_lifes.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)