Im learning pygame by making a rougelike, but i would like to make it look and function nicer than just a bar. My class has a length variable, an image that is just either end of the bar, and an image that is just a line on top and a line on bottom with transparent in between, so that i could tile that image to length. How would i tile it like that, or how would i do that better. Also is there a way to do this with only one sprite class? i hope you have a good day, and thanks for the video.
0:29 or you can create a 3 one Grey one green and one red then the red is I n the same width as the green when you got hit first the green go and then animation for the red
Could you please explain if drawing such a health bar constantly is heavy on performance? In my project i am caching the surf and rect of the hp bar and when player suffers a hp loss, then I am invoking a function to update hp bar and cache a new one. Is this approach considered as optimized?
I haven't noticed any performance issues from using these, but what you suggest makes sense as you can reduce the amount of times the health bar is updated to the times when the health actually changes
I've trying to use this Class as separate py file and import in Main and method draw doesn't work for me. So can this be used by screen.blit drawing tool? And if so, how to do this?
If you create a game window in your main file, then you will need to pass it into the draw method of this health bar, otherwise it won't know it exists and will throw an error. Put the screen as an argument into .draw() and it should work from there
Hello iam Trimnor. i'm learning python but i dont now on what app to make games. Can you tell me on what app you make games, by the way you are the best.
thats so clear dude not like other videos that have 35 minutes to explain small thing
I followed your combat game course and i learned how to create health bars. Keep it up!
Nice! The code is mostly the same for those ones.
You rock man. Keep it up. Doing all your projects. You've taught me so much❤
Thanks, glad to hear it!
Hi from Brazil, man, I've been watching your videos for a while and I always learn something new, you're rock! 🔥🔥
Thanks! Glad you like the videos
Большое спасибо, за то что регулярно делитесь рабочими связками!!!
thank you so much! i was working for like 40 minutes to get a health bar working and this fixed it
Glad it helped!
Very clear explanation.
Cheers!
@@CodingWithRuss
So much so. ✅✅✅
Im learning pygame by making a rougelike, but i would like to make it look and function nicer than just a bar. My class has a length variable, an image that is just either end of the bar, and an image that is just a line on top and a line on bottom with transparent in between, so that i could tile that image to length. How would i tile it like that, or how would i do that better. Also is there a way to do this with only one sprite class? i hope you have a good day, and thanks for the video.
how would i do it for a Platformer game.Should make a code so that when i fall to the ground i lose health ?
Yes you could add these health bars into that game and make it so instead of instantly dying when hitting an enemy, you lose health instead.
I love your style dude, subscribed
0:29 or you can create a 3 one Grey one green and one red then the red is I n the same width as the green when you got hit first the green go and then animation for the red
Could you please explain if drawing such a health bar constantly is heavy on performance? In my project i am caching the surf and rect of the hp bar and when player suffers a hp loss, then I am invoking a function to update hp bar and cache a new one. Is this approach considered as optimized?
I haven't noticed any performance issues from using these, but what you suggest makes sense as you can reduce the amount of times the health bar is updated to the times when the health actually changes
@@CodingWithRuss thank you Russ
A great project to begin to with HTML CSS and JS also (even though it's in Python)
I've trying to use this Class as separate py file and import in Main and method draw doesn't work for me. So can this be used by screen.blit drawing tool? And if so, how to do this?
If you create a game window in your main file, then you will need to pass it into the draw method of this health bar, otherwise it won't know it exists and will throw an error. Put the screen as an argument into .draw() and it should work from there
Thanks for this. Its running
Glad it helped
Simple and efficient !
what IDE are u using?
idk what is a pygame, but this can work in renpy games?
I haven't used renpy games but the health bar logic can be applied anywhere, it would just need to be coded using the relevant syntax
Hello iam Trimnor. i'm learning python but i dont now on what app to make games. Can you tell me on what app you make games, by the way you are the best.
Hello, I use Sublime text editor
@@CodingWithRuss Tank you
and with a circle? i want to do a health bar like diablo 4.
What to do if on line 27 HealthBar takes no arguments.
Simplest explanation possibly. ❤
Thanks :)
Bro you always help us but why don't you provide this program on the message section.😂
Did you have any programming knowledge before making games
super
Thanks
nice, danke
Glad you like it
cool video)
ianni doesnt approve
I want you to be my coding teacher pls give my your number
I love your style dude, subscribed
Thanks! Appreciate it.