RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Health Bar & Swords

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 87
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?
I'm new

********
Absolutely the one chosen by fadark
Rep:
Level 94
GAAAAAAAAY
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.

**
Rep:
Level 87
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
I'm new

**
Rep:
Level 90
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.
« Last Edit: August 20, 2007, 06:51:35 AM by purifier »

**
Rep:
Level 87
Ooh thanks
I'm new

*****
Ancient Mummy
Rep:
Level 90
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

*
Rep: +0/-0Level 84
Yes i too want health related bar that is for patient health records

*
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Rep:
Level 96
&&&&&&&&&&&&&&&&&&&&&&&&&&&
GIAW 14: 2nd Place (Hard Mode)2013 Biggest Drama Whore2013 Zero to HeroParticipant - GIAW 11Secret Santa 2013 ParticipantFor taking arms in the name of your breakfast.
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.
&&&&&&&&&&&&&&&&