Enermy health bar
-
Hmm I'm gonna have to think of another way, health bars aren't allowed to collide. This might end up being fairly complex, instead of showing screenshots I'll post an example to the hub when I'm done (and add another comment in forums to say it's done).
-
@Aidan-Oxley It doesn't really have to be health bars above thir heads. I just wanted a way so that each enermy has it's own health but I just thought that health bars might look cool
-
Yeah it would look cool, I am gonna make it work (nearly done already). I've never made a game myself with hovering health bars above spawned objects.
-
It's done, but I might need to add a few comments and stuff in to make it easier to understand, I will upload it in less than or about 3 hours from now (I'm about to go out, won't be able to use my iPad for a bit).
-
@DGames135 This is knew of those things that should be simple but sadly isn't, because there is no way to select a spawned object without using collisions. The workaround is to use dynamic attributes on a non-spawned object to transfer information between the spawned objects, using an ID to specify which. Here is an example project.
For example, to get the health of the object with ID 2 you would get the attribute "2 Health". It's an inefficient way to do it and I hope Aidan has a better way, but this is all I can think of. With my method you'd probably want to avoid having more than 6 health bars.
Alternatively, if you don't want visible health bars, you could just use an attribute in the enemy called health, and when it gets hit, subtract from that, if it's less than 0 kill it, but this doesn't look as nice.
-
@Jack8680 that's pretty much how I did it, will upload to hub soon
-
It's on the hub now.
-
@Aidan-Oxley Omg thanks. Didn't have time to check it but I will
-
@Aidan-Oxley Ok I checked it and I kinda get it. The thing I got is that you have to give each enermy and health bar a id but the rest of the spawning mechanisms I don't get. Also the combining text is confusing.
-
@DGames135 If you can't figure it out, you can just try to copy it behaviour for behaviour. All the combine text does is combines the words Xposition, Yposition or Health with its ID, all the spawning does is adds 1 to the ID attribute then spawns an enemy and a health bar to go with it.