HP Bar with Values..? Help needed


So.. I'm making a turn based combat game, pretty much Pokemon. So here's the problem, I'm trying to make an hp bar with values. Okay let me explain.

I have it set that if I press the move, it will deal 52-62 (random) damage.
All the other moves have different damage outputs. Which I have to make it so all of them do damage to the hp bar.

The problem is though, is how I even make it go on direction. See I set the length of the hp to be 280 (the starting value for my hp) But for each set of damage I want, I don't know how I can really damage the hp bar at all, without a set amount of damage. This is meant to be fun, not just spam the best moves and win. It's set to be balanced, so I need a bit of help here. Right now I'm building the basic hp bar for the enemy Pokemon, so I can't show a link.


Hmmm I am not quite sure what you are trying to do. But could you "change x by (ValueDamageAmount)

I would probably need to see the project to understand.




I guess you want it to be dynamic, and show the HP of a Pokémon without a number? I'm going to assume that's what you want. I'll start working on getting an example out.


Is this what you need? :)


I'm pretty sure the Pokemon games have some sort of algorithm that creates a ratio of power to damage, factoring in the Attack/Special Attack and Defense/Special Defense stats of both Pokemon.

In my sorry attempt at a Pokemon battle, I gave both Pokemon a starting HP of 100, and if a move had 60 power, it took 60 points off of the opposing Pokemon's HP. You could look in the code to see precisely how I did that.

For an irregular base HP of 280, you'd have to do some fancy math stuffs to figure out the ratio between the power and the damage.

That's all I've got, but I'll be thinking about it! Every time I play the Pokemon games, I end up wondering just how they were able to do all that code!

Sorry if this is impossible to understand; I'm not the best at explaining.


Yeah thanks!


Um, so basically, instead of an HP bar you could do numbers. Lets say if you were in an RPG, someone had full health (3424/3424). Okay, when it subtracts the hp from being hit, the numbers are gonna go down.

So heres an example mathmatically:
3424 - x = ?
All you really need to do is make it into numbers.

If you really want an hp bar, base that evaluation, into trails. If 2400 - 400 = 1800, I think what would work is if you made it divisible, actually, this probably makes no sense to you xD


Zap made a light sabre :00001010100


The thing is, Pokemon moves don't have a set amount of damage in them, plus if I did that. Then people would just spam the stronger moves and win


Make a PP bar. Like, hyper beam can only be used once. Fury swipes can be used 5 times. Etc.


Here's another version

Set up with parameters that easily change the appearance. The HP value is scaled so the bar always fits the Width (upon reflection, I probably should have named that Length instead. Oh well)

It changes color based on the remaining HP

Depending on the usage, you may just directly set the HP value. But FWIW, this Increase Value simply calculates to 1 or 0 (if HP is already at max)

And this Increase value calculates to -1 or 0 (if HP is already at 0)

Conditionals could of course be used but I thought these formulas could prove useful.


It is not dealing hp. Please fix this issue.


I didn't set it to yet


Oh. Thank you for telling me


I'm not sure how I can implement it, into my game


Unfortunately since we can't copy & paste between projects, you'd have to recreate the code in your project. The easiest way is probably to take screenshots that you can refer to.

Copy all the code (and When events, abilities, and variables) from the object 'HP Bar', with the exception of the variables HP & Max HP (I put those under iPad). Change the variables in the ability HP Bar Parameters to suit your project. Other than that, just set and check the HP elsewhere in your code as appropriate.

The project is "HP Bar - sample code (FTU)"
By ThinBuffaloSr in Hopscotch