Make a Legend of Zelda Styled Health Bar with Hearts! (in 14 events!!)

  • 26 favourites

Index

Attached Files

The following files have been attached to this tutorial:

.capx

hearts-tut.capx

Download now 173.59 KB

Stats

4,851 visits, 18,499 views

Tools

Introduction

Hello everyone, and welcome to another tutorial.

Today we are going to make a health bar like in the Legend of Zelda games (and others), where you have a set of hearts on the up side of your screen showing how much health you have.

Little warning: this tutorial is really simple but I set on Intermediate difficulty, since it does use some things that would require some knowledge on how C2 and it's events work. But fear not, as I will explain everything we will do here.

The .capx I saved is uploaded in this tutorial so you can compare if you did anything wrong. I'm currently using v165. Also, don't hesitate to ask me anything if you have trouble or a better solution to what I proposed, just don't forget to tag me in the comment so I can see it.

Let's get to it, shall we?

Creating The Project

Simply create a new blank project. It is a good idea to test your stuff on a different .capx before putting new ideas into your game's code.

You don't need to mess with anything in the side menus for this.

Create a TextBox, a Button and a Text; we are going to use these to set our character's Life points.

Create a Global Variable called life (or whatever you prefer). This is your character's currently health, so you'll actually want to have this as a Instance Variable on your player object, but since we are only testing here, it's a Global Variable.

Follow the code below and try it for yourself.

- Don't forget that the Text object has actual text inside it, not numbers! So you have to put it's content inside a int() function.

Right now, whatever number we insert in the TextBox should show up in the text. Let's keep going.

  • 0 Comments

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