How do I make a fuel slot with numbers ?

Get help using Construct 2

Post » Sat Dec 13, 2014 12:44 pm

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
B
37
S
16
G
2
Posts: 447
Reputation: 4,865

Post » Sat Dec 13, 2014 3:45 pm

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.
B
8
S
1
Posts: 1
Reputation: 439

Post » Sat Dec 13, 2014 8:48 pm

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 :)
B
37
S
16
G
2
Posts: 447
Reputation: 4,865

Post » Sun Dec 14, 2014 12:10 pm

you could do it like so
You do not have the required permissions to view the files attached to this post.
B
249
S
39
G
15
Posts: 1,952
Reputation: 40,596

Post » Sun Dec 14, 2014 5:14 pm

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)?
B
37
S
16
G
2
Posts: 447
Reputation: 4,865

Post » Mon Dec 15, 2014 7:20 am

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
B
249
S
39
G
15
Posts: 1,952
Reputation: 40,596

Post » Mon Dec 15, 2014 7:52 am

here try this demo
You do not have the required permissions to view the files attached to this post.
B
249
S
39
G
15
Posts: 1,952
Reputation: 40,596

Post » Mon Dec 15, 2014 11:44 am

thank U soo so so much :)
B
37
S
16
G
2
Posts: 447
Reputation: 4,865



Return to How do I....?

Who is online

Users browsing this forum: dop2000, namaewayukidesu, Yahoo [Bot] and 4 guests