Java Game Development #21 – Healthbars

Complete Java Game Development Course now available at my website

In this video I show you how to add healthbars into your java game. If you have any questions then be sure to leave a comment or contact me on twitter; realtutsgml. If you learned something then be sure to leave a like, comment, and favorite.

Have you ever wanted to create games? Have you ever gotten fed up with it being to difficult? Well now is the time to thank me and possibly subscribe because you have just found the channel for you! Game Maker Tutorials, Java Game Programming, Unity3D Tutorials, Batch, C++ and much much more! This is the channel for you, the one stop shop for an exploration of your hidden talent as a game developer. Unleash your potential and go wild with imagination when you finally figure out how to make any game you want!

Visit CodingMadeSimple for more exclusive tutorials and get the help you need to succeed as your very own indie game developer!

Follow me on twitter for exclusive content and interaction with me!

Game Maker Studio: Programming
Game Maker Studio: Tutorial
Java Programming
Game Programming
Game Tutorial
Programming Tutorial






42 responses to “Java Game Development #21 – Healthbars”

  1. JenzTheEpicDuckGamer Avatar

    Make a really efficient game tutorial (Efficient game, not necessarily efficient tutorial) please!

  2. pk6 Labs Avatar

    I would suggest making the back of the health bar red so that losing health removes green and "adds red"

  3. dongs sanchez Avatar

    Exception in thread "Thread-2" java.lang.NullPointerException
    at desertTravel.main.Physics.Collision(
    at desertTravel.main.Player.tick(
    at desertTravel.main.Game.tick(
    at Source)

  4. zieben64 Avatar

    This was a really good change, simplified things a lot. I have some animation that plays when the player runs into a ship. Before making Physics class simpler, The animation would sometimes spawn on ships that weren't hit at all. Some weird bug probably because things weren't always synchronized.

    Also, it helped me to change EntityA and EntityB to BulletEntity, ShipEntity, and they both extended Entity. And then myship was just entity.

    I've learned some much from these videos! Thanks RealTutsGML!

  5. Gameriffy Avatar

    how to add sound?

  6. Zenith Avatar

    How do i go to the menu when your lives are up? pls help me.

  7. Luke Dodson Avatar

    does this need LWJGL and opengl or nah?

  8. kamikaisan Avatar

    @1:57 you could make it even simpler by just returning the intersect check expression…say:
    return enta.getBounds().intersects(entb.getBounds());

    and it actually doesn't matter if you do enta against entb or entb against enta, since its an intersection check, if a intersects b, b intersects a, as far as i've noticed

  9. Qazawat Zirak Avatar

    Can any one tell me the name of the dubstep at the begining ? So lovin it !

  10. The Fox army Avatar

    Thanks. I'm expanding the game to be more. I'm adding bosses power ups, menus, and all kind of stuff. This was a great tutorial to start with and I've learned so much and I've gotten so much better at Java!

  11. Nathan Hamers Avatar

    WOW the damn FPS at 8:41 to 9:14 XD

  12. Epicnerd73 Avatar

    Anyone know how to make the enemies explode when a bullet hits them? I've been trying so much and getting some weird results.. :

  13. BackDack Avatar

    thank you mister your the best. i just marathoned the whole series and i am feeling good.

  14. Benjamin Owen Avatar

    How do you clear the enemies in the game after HEALTH = 0?

  15. Genergy Avatar

    I added that if health = 0 then state = menu, but then when I click play again the game is not cleared…the enemies are still in the game…. how to fix that?

  16. FreddyPaperview Avatar

    RealTuts > TheCherno.

  17. PenguinCake Avatar

    This is how mine turned out:

    I used the classic 3 hearts instead of a healthbar, I've drawn and animated the sprites myself and when you die a message dialog pops up (also changed some fonts). I think it looks pretty damn good for a very simple game 😀 Though now I'll follow some tuts of someone else, since I think your code isn't very efficient, well written or well organized. You also didn't always explain what was going on (I think that's because you didn't really understand it yourself but just knew how to do it). No offence of course, I really enjoyed your series and I think it was the best one out there to start java game development.

    So here's a very big thank you +RealTutsGML !

  18. Pera Kojot Avatar

    Can you please tell me how to make game with more levels ? 

  19. Insederec Avatar

    With very small modifications to the code in this tutorial I made this:
    It really is surprising how much a little effort in the appearance of the game makes it look so much better.

  20. John Malick Avatar

    I would like to see a small tutorial to make it more efficient w/o needing to import all that stuff all the time as you mentioned. If you already did a tutorial like that please point me to which video it is. Thanks, John

  21. James Thuresson Avatar

    Not sure if you still answer on this thread but if you do could you just tell me how to reset the game after you die ( go back to menu screen and how to reset the enemy count and kills). Great videos, Thanks.

  22. Backflipmarine Avatar

    Ya thats what i want to be able to make eventually too.

  23. Backflipmarine Avatar

    You're wicked man, thanks for these vids

  24. SystemZee Avatar

    For your next tutorial, you should show how to do that cool little image faded trail like the one in your most recent video about ludem dare, the little box game thingy. (The effect that the player has coming from it when it moves). 😉

  25. Zoraine Avatar

    You could make a simple help screen by using drawString(); on a new enum, like the menu without boxes, and if you needed pictures create a "Pic" class, or something, that draws from textures/animation. Or, if you needed multiple classes, you could put enums within enums. By then it would be more efficient to create an "Enum" class.

  26. Nikita Collingwood Avatar

    Can you do a serious in java on a simple RPG style game like with boxes and just something very simple as that? I think it could be easily explained and also people can learn a ton from that, just an idea for your next serious maybe?

  27. RealTutsGML Avatar

    very soon, very soon.

  28. The486Gamer Avatar

    When is your next video coming?

  29. PHP Java Coder Avatar

    Thanks for uploading it on my birthday

  30. vladim0105 Avatar

    Can you do one on delta time? So that everything that moves on the screen moves at the same speed on every computer (No matter the specs) 🙂

  31. Ben Kamminga Avatar

    I was wondering if you could do these few things before you end the series.
    1.Make the Help button work
    2.Make it that when your health runs out a losing screen with a retry button comes up
    3.this isn't that important but fix the framrate drop issue

  32. Jakub Strnad Avatar

    OH. I was wonder whats about the source code 😀

  33. 666DemonThe Avatar

    can you make tutorials on buffered image array
    i don't understand how it works please
    i have created 2d buffered image array but people say that is not good !!

  34. Linus S Avatar

    I do indeed enjoy watching you and I'm learning alot, I'm actually developing a game of my own grounded on this tutorial and I must say you do it very well, I'd like these tutorials to continue.

  35. adamwpe Avatar

    could find what bullet that killed the enemy by this
    What_do_blow_up was equal to i in the collision event

  36. Funske Avatar

    In the next tutorial could you could have it so when you health reaches zero all the enemies on screen get removed I am having trouble trying to figure it out?

  37. BluePaw wolf Avatar

    Why Didn't you name the site Programmingmadesimple(dot)com ?
    Coding can be many things 😛

  38. Dexkill Avatar

    The FPS get's down how you fix that?

  39. RealTutsGML Avatar

    Of course I am going to continue.

Leave a Reply

Your email address will not be published. Required fields are marked *