Is it possible to nest objects / labels?
-
Hi
I'm currently trying out HP and in the process I'm building a small educational game.
I have a scene, where fruits are dropping from the sky and I want them to show a letter and in stead of making a new frame displaying a new letter, I want to make a label which is nested to the fruit. Is that possible, is there a smart workaround or do I have to go with the tedious solution and make a new frame for showing different letters?Thanx in advance
-
@reynslagdev if you use a label to display the letter, I think you can make it a passable physics object and use the 'weld attach' behaviour to attach it to the fruit. I haven't used labels as physics objects, but I'm assuming it works because there is a physics option for them.
-
I've tried that of a sort. The problem is, that i cant get it to work since I'm spawning the fruit. I haven't found a way to dynamically attach the label to the fruit.
-
@Jack8680 But yes. It works fine using physic's on labels.
-
@reynslagdev yeah, that's a bit more complex. You could use a loop set to 'for each' with a tag so you loop through each object and for example use an attribute to determine which one to weld attach to. You could also use collisions with a tag to do this. For example, if you want the label to attach to the latest spawned fruit you could move them both to the same spot offscreen and use collided with tag then weld attach to tag. This works because it carries the object in the tag it collides with down to all attached behaviours that select that tag. You can then turn collided off after it happens the first time so it only attaches once.
-
@Jack8680 Interesting. I'll try your suggestion. Thank you for your answer.
-
@reynslagdev with the changes to the broadcast/receive message behaviors in the next update, controlling spawned objects is really easy.
-
Put the apple in a group called apple, set the apple to spawn a label on itself upon creation, next go into the label, add a behaviour making it so whenever it collides with anything in the apple group, it will weld to it
-
@T-Studios Interesting! I'll try that out. Thanks.
-
@iTap-Development That sounds nice.