Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smooth health bar thing from indie cross #8790

Closed
FlintIshe opened this issue May 26, 2022 · 8 comments
Closed

Smooth health bar thing from indie cross #8790

FlintIshe opened this issue May 26, 2022 · 8 comments
Labels
question Further information is requested

Comments

@FlintIshe
Copy link

What is your question?

weasdw.1.mp4

Is this possible to make on psych engine?

@FlintIshe FlintIshe added the question Further information is requested label May 26, 2022
@ghost
Copy link

ghost commented May 26, 2022

I know how to do this on source. I think.
I have no knowledge of lua tho.

@FlintIshe
Copy link
Author

I know how to do this on source. I think. I have no knowledge of lua tho.

yeah I mean source lol, but how?

@BrightEyesFox
Copy link

use tweens

@ghost
Copy link

ghost commented May 26, 2022

I know how to do this on source. I think. I have no knowledge of lua tho.

yeah I mean source lol, but how?

Using tweens.
Make it tween to the health instead of automatically setting it there.

@FlintIshe
Copy link
Author

FlintIshe commented May 27, 2022

I know how to do this on source. I think. I have no knowledge of lua tho.

yeah I mean source lol, but how?

Using tweens. Make it tween to the health instead of automatically setting it there.

Yeah i've try it but I just don't know where to put the .tween
can you guys show where exactly i need to put the tween?

@ghost
Copy link

ghost commented May 27, 2022

I know how to do this on source. I think. I have no knowledge of lua tho.

yeah I mean source lol, but how?

Using tweens. Make it tween to the health instead of automatically setting it there.

Yeah i've try it but I just don't know where to put the .tween can you guys show where exactly i need to put the tween?

Find the code where the health bar scale is set to health.
Replace it as a tween.

@PurSnake
Copy link

PurSnake commented May 27, 2022

I know (maybe) how to do it with source without tweens

In PlayState

After public var health:Float = 1;
write:
private var displayedHealth:Float = 1;

In healthBar = new FlxBar(healthBarBG.x + 4, healthBarBG.y + 4, RIGHT_TO_LEFT, Std.int(healthBarBG.width - 8), Std.int(healthBarBG.height - 8), this, 'health', 0, 2);
After "this" change 'health' to 'displayedHealth'

And in override public function update
Add:
displayedHealth = FlxMath.lerp(displayedHealth, health, .2/(ClientPrefs.framerate / 60));

@FlintIshe
Copy link
Author

I know (maybe) how to do it with source without tweens

In PlayState

After public var health:Float = 1; write: private var displayedHealth:Float = 1;

In healthBar = new FlxBar(healthBarBG.x + 4, healthBarBG.y + 4, RIGHT_TO_LEFT, Std.int(healthBarBG.width - 8), Std.int(healthBarBG.height - 8), this, 'health', 0, 2); After "this" change 'health' to 'displayedHealth'

And in override public function update Add: displayedHealth = FlxMath.lerp(displayedHealth, health, .2/(ClientPrefs.framerate / 60));

OMG IT WORKS THANKS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants