Power-up & -down and health bar

1
  • 19 favourites

Index

Attached Files

The following files have been attached to this tutorial:

.capx

power-up-and-health-bar.capx

Download now 81.64 KB

Stats

5,847 visits, 9,681 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Additional techniques

Don't forget delta-time!

In Ashley's tutorial Delta-time and framerate independence the problem of slower and faster computers are discussed.

If your game runs smoothly on your PC, great! But you have no idea how the game will run on other computers, tablets, etc. It makes just sense to integrate the delta-time variable in the health addition and subtraction actions, for example:

Run the game and you'll see a slower reduction of health. In many cases, the refresh rate of the monitors is at around 60[*]dt. So you can play with this value!

- Different monsters can harm the player's health differently.

- The medikit might just be a bit slower to "charge your battery", so this gives the user more adrenaline.. ;-)

And the best thing is, that the health bar will reduce or enlargen at the same speed, regardless of the users' computers.

Slowing down the player

This might be an idea for a more "realistic" player behavior. The less health points, the slower the player moves. What a tragedy, when suddenly monsters or other objects move faster than the player ;-)

In the 8Direction behavior of the Player, the Max speed parameter (currently at 200) is the one to be changed in the conditions where a monster or the medikit overlaps the player.

The formula to be used is: Max speed × Player.Health / 100 in order to change the max speed according to the player's health points. See the image below that there is the identical action included in both conditions we created for overlapping monster and medikit:

Player -> Set Max Speed -> 200[]Player.Health/100*

Timer chapter

coming soon

Another feature might be that the medikit will only give you power for x seconds. After that you can let the medikit vanish from the game or by adding an instance variable like a boolean value telling if the medikit has been used or not.

Lifebar tutorial

Check this one out: Kiyoshi's Making a fancy lifebar

.CAPX

power-up-and-health-bar.capx

Download now 81.64 KB
  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!