logo hyperPad Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Login

    Enermy health bar

    Scheduled Pinned Locked Moved Unsolved
    Help and Support
    3
    13
    902
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Aidan_FireA
      Aidan_Fire @DGames135
      last edited by Aidan_Fire

      Give the enemy a Health Attribute and put them in a tag, make them spawn a health bar when they spawn. Make the health bar not scenery at first (so that it can collide with the enemy), collided with enemy group activates get Health attribute of that group and get position of that group, also turn on a timer that has both the get attribute and get position connected to it, then just add a few other behaviours under the timer only, like move to point get position (or you might like to add a value to the Y position so that it is above the enemy) and set health bar to the attribute. Probably also should set health bar to scenery when that's done. I'm not sure if there's a better way, but that's how I do it, if it's too hard to understand I can try to make some screenshots. EDIT: this does not work as health bars aren't allowed to collide.

      DGames135D 1 Reply Last reply Reply Quote 0
      • DGames135D
        DGames135 @Aidan_Fire
        last edited by

        @Aidan-Oxley I don't get this. Can you show an example?

        Aidan_FireA 1 Reply Last reply Reply Quote 0
        • Aidan_FireA
          Aidan_Fire @DGames135
          last edited by Aidan_Fire

          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).

          DGames135D 1 Reply Last reply Reply Quote 0
          • DGames135D
            DGames135 @Aidan_Fire
            last edited by

            @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

            Aidan_FireA Jack8680J 2 Replies Last reply Reply Quote 0
            • Aidan_FireA
              Aidan_Fire @DGames135
              last edited by

              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.

              Aidan_FireA 1 Reply Last reply Reply Quote 0
              • Aidan_FireA
                Aidan_Fire @Aidan_Fire
                last edited by

                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).

                1 Reply Last reply Reply Quote 0
                • Jack8680J
                  Jack8680 @DGames135
                  last edited by Jack8680

                  @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.

                  Aidan_FireA 1 Reply Last reply Reply Quote 0
                  • Aidan_FireA
                    Aidan_Fire @Jack8680
                    last edited by Aidan_Fire

                    @Jack8680 that's pretty much how I did it, will upload to hub soon

                    1 Reply Last reply Reply Quote 0
                    • Aidan_FireA
                      Aidan_Fire
                      last edited by

                      It's on the hub now.

                      DGames135D 2 Replies Last reply Reply Quote 0
                      • DGames135D
                        DGames135 @Aidan_Fire
                        last edited by

                        @Aidan-Oxley Omg thanks. Didn't have time to check it but I will

                        1 Reply Last reply Reply Quote 0
                        • DGames135D
                          DGames135 @Aidan_Fire
                          last edited by

                          @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.

                          Aidan_FireA 1 Reply Last reply Reply Quote 0
                          • Aidan_FireA
                            Aidan_Fire @DGames135
                            last edited by

                            @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.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post