Life bar but with non-stretch graphics inside.

Get help using Construct 2

Post » Sun Jan 05, 2014 3:18 am

Hello!

I looked up the tutorial "Making a Fancy lifebar". It looks quite well what I wanted.

But not exactly.

It works so that you resize the graphic to fit the width of current "meter position". Common to do so.

But if let's say, I want to use a graphic as a whole, let's say 256 pixels height when 100%, but starting at 0%, which cropping the graphic to nothing, 1 procent = crop to 1x256 pixels... Cropping instead for resizing the graphic, if you understand what I mean?

I also thought of splitting the graphic into 1 pixel thickness slices but maybe it is too much work and there are simpler way?


Just thinking out loud here.... You are welcome to give me your ideas. :)
B
58
S
18
G
13
Posts: 447
Reputation: 10,735

Post » Sun Jan 05, 2014 3:36 am

Maybe putting a black sprite over the "bar sprite" that you're trying to crop? You make the black sprite grow OVER the other one. It's a trick and it will keep your original intact, but it will hide part of it? I don't know if that's what your looking for, but that's what I used for my game and it worked just fine.
alvarop2014-01-05 03:38:08
B
34
S
9
G
3
Posts: 493
Reputation: 4,067

Post » Sun Jan 05, 2014 3:48 am

try using tile background?
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Sun Jan 05, 2014 3:52 am

Black graphic would work if the background is black, but I am doing this harder, the meter background is transparent because I am simulating a test tube, and the graphic background behind that is the level background that is not fixed.

:)
B
58
S
18
G
13
Posts: 447
Reputation: 10,735

Post » Sun Jan 05, 2014 3:54 am

c4sp3r89,
Could you elaborate?
As the suggestion for the "container" for my idea of splitting the graphic into 1px thickness slices? I had the idea of putting it as animation, and choose frame number according to the (even) percent number.
Ok nevermind, of course it is better to have 100 frames with the ever growing meter, not 100 slices.

But still if there's a method to magically crop the picture, then shoot me with it! :)helena2014-01-05 03:56:57
B
58
S
18
G
13
Posts: 447
Reputation: 10,735

Post » Sun Jan 05, 2014 3:59 am

Try this

https://dl.dropboxusercontent.com/u/108799982/Capx%20Demos/HealthBar.capx
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,699

Post » Sun Jan 05, 2014 4:01 am

add tile background object into your project.
add image to the tile background.
Resize.
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Sun Jan 05, 2014 5:42 am

@helena Did you mean something like this? [r155]

HealthBarCrop.capxDuckfaceNinja2014-01-05 06:04:42
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Sun Jan 05, 2014 8:05 am

and another for you to look at


click the red lego button to reduce health


and the capx

capx (155)
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882

Post » Sun Jan 05, 2014 11:50 am

RamPackWobble : Nice implementation. emoaeden2014-01-05 11:51:04
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,699

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 43 guests