I wasn't satisfied with basic reource bar, cause I had some issues with decreasing max health (the bar was stretching or it looked like it is not full but the digits on it said opposite thing). And you actually gave me an excellent idea. Thanks!
Glad you enjoyed it! I’m currently doing a Super Mario World multi part tutorial.The first episode is out if you haven’t seen it yet. ua-cam.com/video/qGcbQXH7oOY/v-deo.html
I assume this can be done for a weapon power bar, correct? For instance if you're shooting a laser, set max ammo & current ammo too 100, then set the condition for example, when left mouse is click Action: subtract 1 from ammo variable Action: ammoBar width set to ammo algorithm.....does that sound right?
@Winstreak1 gonna test it when I'm back at my pc in a few hours....currently I have the firing set to just the left mouse button to just be held down (not repeatable click) cause its a rapid fire laser.....so I still need to add a trigger once to execute the action or no?
@@TrEeBLaZe As long as your action where you are firing your bullet is also subtracting from your ammo - whether you make it once per click or hold and shoot is up to you
@Winstreak1 sorry,Unrelated question to my previous, something I was curious about if thats ok....i want to restrict movement to only about ¾ of the left side of my layout, (making a little top down space shooter to learn the software better) I figure I can add just an hidden collision box at the border I want to keep the player from passing, but I don't want it to be an abrupt stop, like they just flew into an invisible wall! Lol Is there a way to kinda "buffer" the collision? So they have like lets say a 20 pixel grace area, before there pushed back away from the collision box, by a force I assume I would have to add to the player?
Create any Event Condition you want for when the player should be healed. (Right click the hero would make sense for my example - for a game something like on collision with a heart object). The actions will be the same Except instead of subtracting from the health variable we will add to it. Note: Nothing in the code stops health from going above max health. We clamp the healthbar but there is no code to stop health from going higher than max health. You can fix that with a 1 line event: Condition if Variable of RedHero Health > Variable of RedHero Max Health | Action Set Variable of RedHero Health = to RedHero Variable MaxHealth
Make all the objects you are using Global, this will allow you to use them on multiple scenes. If you are changing scenes and need to remember the current values you have in your Health bar Object Variables you will have to store them in a Global variable, I don't believe there is a way to send your current instance of the object from 1 scene to another.
Open the properties of the HealthBar Object and click the Edit Points button on the bottom left. Inside Edit Points you will want to move the Origin point from the left side to the right side. (You will need to re-align your HealthBar inside of the HealthBarBox on your Scene once you do this)
Happy to help :) Technically, you would not want to set your hero to die based off the HealthBar, but instead based off the Hero Variable 'Health'. In a new event: Condition: Hero - Value of Object Variable is 'Less than or equal to' 0. Then you would put the death actions on the right side. Usually something like set death animation - drop gold - drop items. Then a new event for on hero death animation is finished - delete hero.
Sure! Add a text object this will display your Health. Anytime you want to update this - you can do it whenever damage is give or every tick - You will add an action to Change the text of (the new text object): Set to Hero.Variable(Health) - or whatever you named your Health variable and player to!
@@senselessvoid7331 You should have a variable for both your Health and MaxHealth - this will take care of the percentage calculations. The only value you have hard coded is (in my case) 311, 0 , 311. The first and last value is the width of your health bar, in the first position you are using it to multiply by your percentage. 1 (being 100%) multiplied by 311 would give you a full bar of 311, 0.5 x 311 would give you a half bar of 155.5. The second 311 is a clamp, this just stops the bar from traveling past 311 pixels which is a full bar. Last, the 0 is your clamp on the other end (dead character). This will protect your bar from going too far to the left if your character has negative health. If you have 1000 health you should only need to change your Health and MaxHealth Variables to match. If you change the size of your health bar you will need to change the 311 values.
@@senselessvoid7331 Happy to help! Here's a link to my Discord, if you ever bump into problems I'll do my best to help you out. Discord makes it possible to share screen shots which makes debugging a lot easier :) discord.gg/B74N5qrpvU
You should do it off the health variable if it is less than or equal to 0. I usually set a death animation at this point. If it’s an enemy you can add drops at this point and stop letting the enemy interact with the player. Once the death animation finishes delete the object.
You need to add the object variable to the object and make sure you are looking at Object variables when you are in your event sheet. Here are both the time stamped parts of the video: ua-cam.com/video/LhbqxPxZJ5I/v-deo.html ua-cam.com/video/LhbqxPxZJ5I/v-deo.html
wow beautiful tutorial, short, quick and simple. Love it keep it up making more!
Thanks IzFan!
I will keep on making them if you keep on watching them. :)
Notification on!
You are an amazing youtuber, no joke. Man love ur content, u helped me out a lot. You are really underrated
Thank you so much!
I notice you watch both my Construct and GDevelop content. Do you use both engines?
@@Winstreak1 no actually I don’t but it’s still good to get basic knowledge for different engines
@@Kjx9Beats Oh, well thanks for watching both then! :)
I wasn't satisfied with basic reource bar, cause I had some issues with decreasing max health (the bar was stretching or it looked like it is not full but the digits on it said opposite thing). And you actually gave me an excellent idea. Thanks!
Huzzah!
Happy to help.
Amazing Video Bro! This worked perfectly!
Glad to hear it!
What's the project you are working on?
thank you for showing the clamp feature. i had the rest figured out but that. much appreciated
Haha happy to help, even if it was just a tiny nugget!
Thanks for making this tutorial. Looking forward to more. 😀
Glad you enjoyed it!
I’m currently doing a Super Mario World multi part tutorial.The first episode is out if you haven’t seen it yet.
ua-cam.com/video/qGcbQXH7oOY/v-deo.html
Im just thankful that this tutorial wasnt like the ones I just watched. It had no narration and was sped up.
Thanks!
No promises on not speeding things up, but I will always do my best to talk you through what's going on.
I assume this can be done for a weapon power bar, correct? For instance if you're shooting a laser, set max ammo & current ammo too 100, then set the condition for example, when left mouse is click
Action: subtract 1 from ammo variable
Action: ammoBar width set to ammo algorithm.....does that sound right?
Yes, sounds like you are on the correct path. Feel free to try it out and if you bump into problems let me know them and I will help you out.
@Winstreak1 gonna test it when I'm back at my pc in a few hours....currently I have the firing set to just the left mouse button to just be held down (not repeatable click) cause its a rapid fire laser.....so I still need to add a trigger once to execute the action or no?
@@TrEeBLaZe As long as your action where you are firing your bullet is also subtracting from your ammo - whether you make it once per click or hold and shoot is up to you
@Winstreak1 ok understood thanks, ill let you know how it works out
@Winstreak1 sorry,Unrelated question to my previous, something I was curious about if thats ok....i want to restrict movement to only about ¾ of the left side of my layout, (making a little top down space shooter to learn the software better) I figure I can add just an hidden collision box at the border I want to keep the player from passing, but I don't want it to be an abrupt stop, like they just flew into an invisible wall! Lol
Is there a way to kinda "buffer" the collision? So they have like lets say a 20 pixel grace area, before there pushed back away from the collision box, by a force I assume I would have to add to the player?
thank A LOT buddy
No worries, Happy to help!
How to do you use this same method to Heal the player?
Create any Event Condition you want for when the player should be healed. (Right click the hero would make sense for my example - for a game something like on collision with a heart object).
The actions will be the same Except instead of subtracting from the health variable we will add to it.
Note: Nothing in the code stops health from going above max health. We clamp the healthbar but there is no code to stop health from going higher than max health. You can fix that with a 1 line event: Condition if Variable of RedHero Health > Variable of RedHero Max Health | Action Set Variable of RedHero Health = to RedHero Variable MaxHealth
How would you make this health global?
Make all the objects you are using Global, this will allow you to use them on multiple scenes. If you are changing scenes and need to remember the current values you have in your Health bar Object Variables you will have to store them in a Global variable, I don't believe there is a way to send your current instance of the object from 1 scene to another.
Nice, thanks
Thank you for taking the time to watch my video's'! 🥰
How to do if i want to reduce length from left to right ?
Open the properties of the HealthBar Object and click the Edit Points button on the bottom left.
Inside Edit Points you will want to move the Origin point from the left side to the right side.
(You will need to re-align your HealthBar inside of the HealthBarBox on your Scene once you do this)
Thanks so much for this tutorial! Just wondering how you make it follow the player and make it that once the health bar reaches 0 the player dies?
Happy to help :)
Technically, you would not want to set your hero to die based off the HealthBar, but instead based off the Hero Variable 'Health'.
In a new event:
Condition: Hero - Value of Object Variable is 'Less than or equal to' 0.
Then you would put the death actions on the right side. Usually something like set death animation - drop gold - drop items.
Then a new event for on hero death animation is finished - delete hero.
@@Winstreak1 Thank you so much :)
DUDE THAT'S AWESOME! Anyway any idea how do you also change the Text that has the HP remaining of my Hero each time it reduces?
Sure!
Add a text object this will display your Health. Anytime you want to update this - you can do it whenever damage is give or every tick - You will add an action to Change the text of (the new text object): Set to Hero.Variable(Health) - or whatever you named your Health variable and player to!
@@Winstreak1 COOL! But what if my max HP is set to 1000? what should I put in the Action variables since my lifebar is smol but has 1000 hp on it?
@@senselessvoid7331 You should have a variable for both your Health and MaxHealth - this will take care of the percentage calculations. The only value you have hard coded is (in my case) 311, 0 , 311.
The first and last value is the width of your health bar, in the first position you are using it to multiply by your percentage. 1 (being 100%) multiplied by 311 would give you a full bar of 311, 0.5 x 311 would give you a half bar of 155.5. The second 311 is a clamp, this just stops the bar from traveling past 311 pixels which is a full bar.
Last, the 0 is your clamp on the other end (dead character). This will protect your bar from going too far to the left if your character has negative health.
If you have 1000 health you should only need to change your Health and MaxHealth Variables to match.
If you change the size of your health bar you will need to change the 311 values.
@@Winstreak1 BRO THAT IS VERY HELPFUL! YOU EARN MY SUB *claps* THANK YOUU!!!
@@senselessvoid7331 Happy to help!
Here's a link to my Discord, if you ever bump into problems I'll do my best to help you out. Discord makes it possible to share screen shots which makes debugging a lot easier :)
discord.gg/B74N5qrpvU
Why does the health bar instantly go to zero?
The health bar has default values inside the properties make sure those are all set correctly
@Winstreak1 all fixed thanks!
Thanks, how about new tutorials?
Working on a new one!
It works thank you very much, but how do I do that when the bar ends the character is deleted?
You should do it off the health variable if it is less than or equal to 0.
I usually set a death animation at this point. If it’s an enemy you can add drops at this point and stop letting the enemy interact with the player. Once the death animation finishes delete the object.
I can't find value of an object section
You need to add the object variable to the object and make sure you are looking at Object variables when you are in your event sheet.
Here are both the time stamped parts of the video:
ua-cam.com/video/LhbqxPxZJ5I/v-deo.html
ua-cam.com/video/LhbqxPxZJ5I/v-deo.html
I thought this was about health bars HMMMMM. The ones we eat!!!!!
No Heath Bars around here!
For me theres no object variables :/
You need to create the Object variables... Go back to 01:35
thx@@Winstreak1
Thanks
You're very welcome Evawropa! 😀
Hi
Hello Satish :)