Need help with shooting and monsters killing you.
-
I’m trying to do like hitpoints.
-
@GAE-Network
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. -
@Aidan-Oxley What’s the best way to attach a health bar object to each enemy?
-
@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!
-
@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.
-
@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.
-
@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-Development Actually, I think you might be right. I haven’t played with broadcast messages since they added the dynamic names. This is good.
-
@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.
-
@iTap-Development Sorry, what do you mean about custom particles? Precaching them by firing the particle emitter before needed?
-
@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.
-
@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.
-
@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.
-
@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.
-
@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.
-
@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.
-
@Deeeds here are some screen shots from the tutorial with some basic explanations...hope it helps!
-
@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.
-
@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.
-
@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!"