Tutorial: Making a simple HP bar in C3

  • I wanted to share my way of doing a HP bar, you can experiment alot to get a nice HP bar, this tutorial just shows some basics and the easy way of creating one.

    First, create 3 sprites, called BarRED,barGREEN & PLR . Fill the redbar with red color and the green with green etc.

    Now the pin behavior i have just added if you want it attached to the player, if the player is moving, this you can skip.

    Add the keyboard plugin for your project, also set 2 instance variables on either the PLR or barGREEN sprite. 1 instance var called CURHP and 1 called MAXHP

    like this:

    then, add a event, on KEYBOARD KEY PRESSED X substract 10 from curhp, set the redbar width to the instance variable MAXHP.

    Add every tick > set width of greenbar to object.curhp

    I set the bars to be containers with eachother, wich means if 1 is created, the other 1 is created to, if 1 is deleted, the other one is deleted to.

    I did this tutorial for a friend very fast, if u need help just ask.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)