The RPG Maker Resource Kit

Other Game Creation => Other Game Making Programs => Topic started by: Sfnix on June 06, 2007, 05:08:58 PM

Title: Health Bar & Swords
Post by: Sfnix on June 06, 2007, 05:08:58 PM
Hello again, I've learned how to use some things in Game Maker now, but I don't know how to make a health bar (NOT life things which disappears when you die) that gets damaged by monsters if they get close. I would also like to make my character wield a sword which he can swing and any monster infront of him dies. Can anyone who got some time to help me tell me how to do these things?
Title: Re: Health Bar & Swords
Post by: biohazard on June 10, 2007, 11:43:13 PM
Well, for using a sword I make a damage object, something that will hurt an enemy, like a bullet, but not have it move, and have it destroy itself almost as soon as it is created, and when your character swings his sword, you can have it create this object infront of him, so he will destroy any enemy that is there.
Title: Re: Health Bar & Swords
Post by: Sfnix on July 14, 2007, 07:42:26 PM
Well, for using a sword I make a damage object, something that will hurt an enemy, like a bullet, but not have it move, and have it destroy itself almost as soon as it is created, and when your character swings his sword, you can have it create this object infront of him, so he will destroy any enemy that is there.

Hm... Okay I'll try it out
Title: Re: Health Bar & Swords
Post by: purifier on August 20, 2007, 06:42:58 AM
Well, I made an example just for you! Yep, I was bored, so I took the time to make you an example of how I would make my own life bar. Now, this is a simple one, but... meh, it works as far as I can tell. I might release an updated version with health packets to heal you, since I just now thought of it, and how it may cause errors with the system if there isn't a new IF statement added.

Edit: After looking over the code I found that I created 11 pieces, which I have now fixed and I will upload an updated gmk.

Download Example Here: http://www.warhive.com/storage/hbar.gmk

Quote from: Game Information
Custom Health Bar
Example Project
****************************************************************
I decided to create my own health bar system. It's very crude and -most probably- inefficient.

When the room Limbo is created it's creation code creates ten (10) instances of obj_health. These instances make up the bar.

I'm sure that someone else could probably come up with a way to calculate the location of the bar so it doesn't have to manually be entered, but I'd rather hard-code it into the system. You're probably wondering why you wouldn't just use the built in system bar. I don't know why you wouldn't. I, personally, like to do everything myself with as little "drag and drop" as possible. I'm also very lazy, however.



Now, how this works:

The player collides with the spike. The spike has within it's collision settings two separate scripts. The first one is the collision with the player, the second is the health bar check. The room, Limbo, created a global variable (I'm sure this isn't the best idea, but it's used for this example. It doesn't matter where you put the script at, as long as it's run at initialization.) that monitors your health bar level.

In essence, this is a pseudo-health bar. It's just ten health pieces shoved together to give the illusion of a bar. You really only have ten health, at most ten hits. I tried to create a damage animation by making a blinking sprite, but I, again, am a lazy person and decided not to implement it. Please ignore any extra code that has to do with the sprite spr_player_damage.

By the way, when you die the game is over. Just hit ESC to quit. Again, I was being lazy and didn't put in a reset button, which I probably could have implemented in the time it took me to type this sentence.

You move with the ARROW KEYS. If you feel you move too slow, by all means, change the speed.
Title: Re: Health Bar & Swords
Post by: Sfnix on March 15, 2008, 10:46:51 PM
Ooh thanks
Title: Re: Health Bar & Swords
Post by: Snailer on September 30, 2008, 02:16:13 PM
Well, for using a sword I make a damage object, something that will hurt an enemy, like a bullet, but not have it move, and have it destroy itself almost as soon as it is created, and when your character swings his sword, you can have it create this object infront of him, so he will destroy any enemy that is there.
That's awesome!

Thanks
Title: Re: Health Bar & Swords
Post by: dhanarajesh1 on November 11, 2008, 10:27:41 AM
Yes i too want health related bar that is for patient health records
Title: Re: Health Bar & Swords
Post by: &&&&&&&&&&&&& on November 12, 2008, 12:16:55 AM
Yes i too want health related bar that is for patient health records

Yes i want to help relating to your question but is for your english sucks

Ask again with proper english, and I will see what I can do.