Submit Your Article Guild Wars 2 Forum RPG Maker VX.com
 
RPG Maker
 

 Username:
 Password:
   Not a member? Register!



Home > Tutorials > Game Maker > Game Maker Custom Health Bar

Game Maker Custom Health Bar


We're going to be making a custom healthbar for gamemaker. Many people find the default bar very tacky, so I came up with a new method that is similar to health in fire emblem.

Here's the sprites we'll need for the game:

The character:
picture

The Health Icon:
picture

An enemy:
picture

And a powerup:
picture
(You can tell I didn't work very hard on the graphics)

Make objects for the hero, the enemy, the powerup, and a blank object, which I called objController

First, let's make the hero movable.

Make keyboard triggers for Up, left, down, and right.
For up, tell the object to move to a specified position, and set the y relative to -4
Use this same theory for all of the other directions (more info and different methods can be found in my Game Maker Movement Types tutorial).

Now go over to the objController, and make a Create trigger. Set the health to whatever you want. I set mine to 20.
Now make a Draw trigger. Set 2 variables (I called mine varHPx and varHPy) to the coordinates where you want the first HP icon to be drawn.
Make a repeat event with the number of times "health".
Use the Triangle icons to create a group under the repeat.
Now, use the Draw Sprite command and draw the HP icon at varHPx and varHPy.
Then, add to varHPx. I added 7, so there would be a small gap between each icon
So, it should look like this after you've done everything:
picture

Now, go to the hero object. Make a collision with enemy trigger. Tell it to destroy the enemy and reduce health by one.
Repeat for the powerup collision, but increasing health by one.

Test it out, and it should work!

picture 
Details
Tutorial: Game Maker Custom Health Bar
Date Listed: 2008-07-06
Author: HeroOfHyla
Total Hits: 8320


Embed
Short URL:

HTML:

BB Code:



RPG RPG Revolution
RPG RPG Revolution is your #1 stop for game development and console RPG games, as well as those created by people like you. Link to us to support us, so we may grow to be better website community for you.

RPG RPG Revolution is an Privacy Policy and Legal