How do I make health system

1 favourites
  • 5 posts
From the Asset Store
Custom animated Health Bar - check youtube video to make it yourself
  • I am trying to make basketball game in which player tries to score as many balls into net. The player starts with 3 in upper left hand corner with a ball showing indicating that if he misses a shot, 2 will then show up, another shot missed would mean it would go down to 2 and then another shot missed would mean it would go down to 1 showing up in upper left hand corner until reaches 0. How all would you guys recommend me going about setting this health part of my game up?

  • By using a global variable called Health, with initial value 3.

    Display it on a text object somewhere Set text ""&Health.

    When player misses shot, subtract 1 from Health.

  • Could you provide a capx with this and/or another method of achieving the same effect. I tried this and it didn't work for me.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Using variables to control many things (like health, ammo, etc) is a fundamental and basic part of construct 2, and programming in general.

    Once you learn how to use these simple but powerful tools, it will all make sense.

    I can try to make an example today (I expect a fairly quiet day in the office today) but I will have to see if time does in fact allow.

    Essentially, you need to create a global variable on your event sheet (right click on the event sheet and add global variable) then name it HEALTH. Set the initial value to 3.

    Anytime you want to subtract 1 from health, you have your condition for doing so... example: player collides with enemy ->(action= subtract 1 from global variable HEALTH).

    Then you have another event that checks what the health is at: global variable health = 0 ->(action: destroy player)

    You can use variables to track all kinds of stuff that you need to be, well, variable... so simple yet so powerful when used in certain ways.

    ~Sol

  • Like this? Should probably be in beginner's questions if you're not sure on how to use variables. https://www.dropbox.com/s/v3q2c86ftl6fa ... .capx?dl=0

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)