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

    Need help with shooting and monsters killing you.

    Scheduled Pinned Locked Moved
    Help and Support
    7
    41
    2.1k
    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 @SytheMedia
      last edited by

      @GAE-Network
      0_1510346505913_3C68CBB4-51D9-4DE9-9A44-CE2EFF15F293.png
      The box container is the monster’s health (in my Example, it has 10 health). When the monster gets hit by a bullet, you subtract a number (in my example, hitting a bullet takes 1 health), and then set the box container to the new subtracted health (this is don’t by using the set input field with the output of subtract values in it. You can get the set input field behaviour by pressing the box container, then at the far left of the text field press the button there. Now, if the monsters health reaches zero, it will die (be destroyed). Hope this makes sense.

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

        @Aidan-Oxley What’s the best way to attach a health bar object to each enemy?

        D Aidan_FireA 2 Replies Last reply Reply Quote 0
        • D
          Deeeds @Kamdroid
          last edited by

          @Kamdroid I'm not helping here: physics is the best way to do it, but hyperPad hasn't turned on the physics capabilities of health bars.

          My best alternative (doesn't work for fast moving or dynamic characters) is to use Move To focused on the character with an appropriate offset. Nowhere near good, nothing like the organic magic of physics. DOH!

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

            @Kamdroid With difficulty. You can just run a timer and move to object, because hyperPad doesn’t really give you a way to find the right object (since they will be a bunch of spawned objects). The way my 3D points work (the faces of the shape have to conform to their spawned points) is the actually Collide with the point, which is in a tag, and the collision with that tag is being detected. Then any behaviour underneath that uses that tag will only use the object it collided with. Just as I was writing this I thought of another way using arrays, storing the positions of every object constantly in an array could work, but I don’t know what would happen if 10 or 20 objects were modifying an array 60 times a second.

            iTap DevelopmentI 1 Reply Last reply Reply Quote 0
            • iTap DevelopmentI
              iTap Development @Aidan_Fire
              last edited by

              @Aidan-Oxley you can easily communicate with spawned objects using broadcast and receive message. Basically broadcast key is the object you want, and each object when created you set its id and use it for the receive key.

              D Aidan_FireA 2 Replies Last reply Reply Quote 0
              • D
                Deeeds @iTap Development
                last edited by

                @iTap-Development How do you create broadcasts with the unique keys of the spawned objects? You don't know what their IDs will be at launch.

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

                  @iTap-Development Actually, I think you might be right. I haven’t played with broadcast messages since they added the dynamic names. This is good.

                  1 Reply Last reply Reply Quote 0
                  • iTap DevelopmentI
                    iTap Development @Deeeds
                    last edited by

                    @Deeeds the broadcast key needs to be a variable or you could use set input field. I prefer the former.
                    The receive keys in the spawned objects will be set when they are created. So you could have it be simply objects 0-100 or name them for certain uses etc. then just change the broadcast variable for the object you want.
                    And obviously in the spawned object you would have the behaviors you want run connected under the receive message behavior.

                    I know it works because that’s what I did in the interactive tutorial for the line connecting the behaviors.

                    And I would recommend spawning all the objects you want at the beginning and bringing them on screen as you need them, since spawning is a slower behavior. For example making custom particles etc.

                    D 1 Reply Last reply Reply Quote 0
                    • D
                      Deeeds @iTap Development
                      last edited by

                      @iTap-Development Sorry, what do you mean about custom particles? Precaching them by firing the particle emitter before needed?

                      iTap DevelopmentI 1 Reply Last reply Reply Quote 0
                      • iTap DevelopmentI
                        iTap Development @Deeeds
                        last edited by

                        @Deeeds it was just an example of something you could do with my idea. But what I’m saying is you could create your own particle by spawning all the of objects you need OFF SCREEN (instead of spawning as you need them, since spawning is a slower behavior) and then using broadcast message to have them do whatever it is you want for the particle. And you would probably want to name then numerically.

                        D 2 Replies Last reply Reply Quote 0
                        • D
                          Deeeds @iTap Development
                          last edited by

                          @iTap-Development Cool. Got it. For me, quite annoyingly, I can do this kind of looping in code quite elegantly, but really struggle with the mechanics and messy way it needs to be done in hyperPad. But really need to do this simply to overcome the lack of parenting and non-physical attachments and relationships between objects.

                          D 1 Reply Last reply Reply Quote 0
                          • D
                            Deeeds @Deeeds
                            last edited by

                            @iTap-Development let me see if I've got this right:

                            A loop broadcasts, in the loop is a call to a variable that's incrementing with each cycle of the loop, and being used to ID objects? What I'm missing is how the name/ID of the objects is created so that this name can be stored in an array or dictionary. The lack of ability to hold a reference to, or address of, an instance of an object is... troubling me.

                            Jack8680J 1 Reply Last reply Reply Quote 0
                            • D
                              Deeeds @iTap Development
                              last edited by

                              @iTap-Development As is the lack, I think, of abilities to dynamically rename/name objects. I can't figure that part out, either. I'm missing something in conceiving how hyperPad handles spawning, and what it was intended to be and do.

                              iTap DevelopmentI 1 Reply Last reply Reply Quote 0
                              • iTap DevelopmentI
                                iTap Development @Deeeds
                                last edited by

                                @Deeeds yep you could use a loop or create your own, I guess depending on you needs.
                                So you are saying you want to have an array of the objects you’ve created so you know what to broadcast? I don’t think that would be necessary with numerically named id but if you want names like wall 1 or enemy 3 then I can see where that would come in. So if I understand correctly, just put id’s in an array when you create the objects.
                                I don’t think anyone will argue that we need everything to be dynamic. I would honestly prefer dynamic everything came before new features, since no dynamic means less use for the features.

                                Spawned objects are basically exact replicas of the object. They can, for the most part, work independently with the exception of not being able to be talked to by object name. Although you can use tags for limited use, for example put a tag on the object and then it or any of its spawned objects could have a collide behavior with that tag, and then when one collides only that one would react.

                                D 1 Reply Last reply Reply Quote 0
                                • D
                                  Deeeds @iTap Development
                                  last edited by

                                  @iTap-Development Cheers. I'll do some more mulling and experimenting. There are other things I'm doing and exploring and working around the ways of hyperPad, and with it... I agree... dynamic addressing needs to be first, before even functions, parenting, Undo in behaviours, etc.

                                  iTap DevelopmentI 1 Reply Last reply Reply Quote 0
                                  • iTap DevelopmentI
                                    iTap Development @Deeeds
                                    last edited by

                                    @Deeeds here are some screen shots from the tutorial with some basic explanations...hope it helps!0_1510510239477_23B51BFF-6BA1-4831-9B70-B4921379BCA4.jpeg 0_1510510327808_FD9D7265-DC28-4CA5-A6CE-5853273999C7.jpeg

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

                                      @Deeeds how you assign them an ID depends on what you want to use them for.

                                      If you have a game with objects you want to select by position, their IDs could be based on the X and Y position.

                                      If you want to be able to select the Nth spawned object or just give an object a unique ID, create an attribute on some non-spawned object that always exists, and let the spawned object get this value, set it as its ID, and increment the value by 1.


                                      You can use this kind of thing to add a relationship between objects. If you want a long and probably hard to follow example I'm making a game right now where an enemy spawns a hitbox for a sword thrust, that will damage the player, unless the player is parrying, which will deflect the hit and stun the opponent for a moment.

                                      Enemies spawn a hitbox are spawned using a broadcast message, broadcasting to 'damageBox' with the value being an array of information (owner position, rotation, offset to spawn at, etc).

                                      I have an empty object that is never destroyed that receives this message. When the message is received, it uses an internal object counter in the form of a box container, which is incremented by 1 each time. It combines this with text to make a unique attribute for each hitbox being spawned. It sets this attribute to the array of values.

                                      The hitbox object is simply an empty object that uses the values passed on to it to calculate the position and rotation it should go to. It uses an incremental ID attribute on the main empty object to get the attribute that was set before (a work around because when multiple run at once there is a slight delay before spawned objects run, so they would all get the last attribute without an ID system). The Hitboxes set an attribute to the ID of their owner.

                                      The player has behaviours when collided with the hitbox, if the player is parrying it will get the hitbox' owner attribute and broadcast to combine text of "parry" and the owner ID. The owner has a receive message for this that causes it to turn of its behaviours for a moment.

                                      D 3 Replies Last reply Reply Quote 1
                                      • D
                                        Deeeds @Jack8680
                                        last edited by

                                        @Jack8680 @iTap-Development Thank you both very much... I'm knee deep in graphic design at the moment, and considering how that influences what I can do, and want to do... but will get to this in a few hours, I hope.

                                        1 Reply Last reply Reply Quote 0
                                        • D
                                          Deeeds @Jack8680
                                          last edited by

                                          @Jack8680 I've read this a dozen times, and I still can't see how to have a reverence to an object so I can tell it to "go to this position!"

                                          iTap DevelopmentI 1 Reply Last reply Reply Quote 0
                                          • iTap DevelopmentI
                                            iTap Development @Deeeds
                                            last edited by

                                            @Deeeds do you understand how to trigger an objects behaviors with the broadcast? If so, you just put the position(as an array) in the value field of the broadcast behavior and then you can use it in the object to set the position.

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