How To Create Health Bars | Pygame Tutorial

Поделиться
HTML-код
  • Опубликовано: 27 дек 2024

Комментарии • 48

  • @SAC.489
    @SAC.489 6 месяцев назад +9

    thats so clear dude not like other videos that have 35 minutes to explain small thing

  • @TheLastProgrammer
    @TheLastProgrammer Год назад +10

    I followed your combat game course and i learned how to create health bars. Keep it up!

    • @CodingWithRuss
      @CodingWithRuss  Год назад +1

      Nice! The code is mostly the same for those ones.

  • @garyonk
    @garyonk Год назад +14

    You rock man. Keep it up. Doing all your projects. You've taught me so much❤

  • @initdef6773
    @initdef6773 Год назад +3

    Hi from Brazil, man, I've been watching your videos for a while and I always learn something new, you're rock! 🔥🔥

  • @BattistinaVolpi
    @BattistinaVolpi Год назад +2

    Большое спасибо, за то что регулярно делитесь рабочими связками!!!

  • @oKanekei
    @oKanekei Год назад +1

    thank you so much! i was working for like 40 minutes to get a health bar working and this fixed it

  • @SkyFly19853
    @SkyFly19853 Год назад +5

    Very clear explanation.

  • @mitchellvandongen1732
    @mitchellvandongen1732 8 дней назад

    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.

  • @Karou571
    @Karou571 Год назад +5

    how would i do it for a Platformer game.Should make a code so that when i fall to the ground i lose health ?

    • @CodingWithRuss
      @CodingWithRuss  Год назад +1

      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.

  • @artcadedev
    @artcadedev Год назад

    I love your style dude, subscribed

  • @shalevforfor5550
    @shalevforfor5550 11 месяцев назад

    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

  • @Orzech97
    @Orzech97 Год назад +1

    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?

    • @CodingWithRuss
      @CodingWithRuss  Год назад +2

      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

    • @Orzech97
      @Orzech97 Год назад

      @@CodingWithRuss thank you Russ

  • @takeaginshxt
    @takeaginshxt Год назад +1

    A great project to begin to with HTML CSS and JS also (even though it's in Python)

  • @ARIADNARB
    @ARIADNARB Год назад +1

    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?

    • @CodingWithRuss
      @CodingWithRuss  Год назад

      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

  • @holy_roman_emperor01
    @holy_roman_emperor01 Год назад +1

    Thanks for this. Its running

  • @Clelie.G
    @Clelie.G 4 месяца назад

    Simple and efficient !

  • @toosuper5828
    @toosuper5828 6 месяцев назад

    what IDE are u using?

  • @echikai1236
    @echikai1236 Год назад

    idk what is a pygame, but this can work in renpy games?

    • @CodingWithRuss
      @CodingWithRuss  Год назад

      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

  • @ttrimnor
    @ttrimnor Год назад +1

    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.

  • @igribeiro_
    @igribeiro_ 11 месяцев назад

    and with a circle? i want to do a health bar like diablo 4.

  • @jothamstephens104
    @jothamstephens104 Год назад

    What to do if on line 27 HealthBar takes no arguments.

  • @prateek5497
    @prateek5497 Год назад +2

    Simplest explanation possibly. ❤

  • @SahilSoni-x3g
    @SahilSoni-x3g Год назад

    Bro you always help us but why don't you provide this program on the message section.😂

  • @ryanmichalski7420
    @ryanmichalski7420 Месяц назад

    Did you have any programming knowledge before making games

  • @aaronjayanmathew6745
    @aaronjayanmathew6745 Год назад +2

    super

  • @mysz705
    @mysz705 Год назад +1

    nice, danke

  • @AyodejiAdedayoAdeosun
    @AyodejiAdedayoAdeosun 10 месяцев назад

    cool video)

  • @sirpiranha5252
    @sirpiranha5252 5 месяцев назад

    ianni doesnt approve

  • @PpPp-tl5li
    @PpPp-tl5li 7 месяцев назад +2

    I want you to be my coding teacher pls give my your number

  • @artcadedev
    @artcadedev Год назад +1

    I love your style dude, subscribed