How do I make a fuel slot with numbers ?

0 favourites
  • 9 posts
From the Asset Store
You control a chopper that flies through a cave!
  • Hi guys, how can I make this:

    If my spaceship flies arround it looses fuel. The fuel should be a text : 100 fuel is 0 empty.

    How can I make that after a certain distance in pixels it looses 1% ecc... and this should of course change the number slot.

    Is there somwere a capx file arround.?

    thanks guys

  • There are few ways to do this. But here is what I would do.

    Let’s take a variable called FuelStatus which will represent the percentage of fuel in the spaceship. 100% means FuelStatus= 1.00 and 0% means FuelStatus = 0.00. All the other values are in between 0.99 and 0.01.

    Now we can multiply FuelStatus with height or width of a sprite to scale it to a percentage of its own size.

    E.g

    FuelMeter.Width * FuelStatus

    This will create a progress bar

    FuelMeter.Height * FuelStatus

    This will be like a bar rising or shrinking in height.

    But we have to do it every time FuelStatus is changed to keep everything uptodate.

  • hi thanks 4 he reply.. iam so sorry, i did explain badly what i mean. what I need is still the full status, but the fuel is going to lower % if my ship travels a certain distance in pixels. How can I manage that ? is it possible get a capx sample ?

    thanks again a lot

  • you could do it like so

  • thank u so much 4 the help can I make this with a not scrollable background and not trough timer.but trough pixel distance. Or maybe if pixeldistance is not possible...maybe trough the pressed time duration of the afterburner button (arrowa)?

  • mariogamer yes you can all you do is ship travel distance > 350 pix then fuel -1 and so on.depend on how you want to code it

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • here try this demo

  • thank U soo so so much

  • Most welcome

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