Is there a parent child heirarchy object?
Good day all,
I have been looking through various objects and ways and have come out with some ways to tie a parent object to a child object... like a turret to a tank and such...
Just wondering is there a simple parent - child object available or an inbuilt function / feature which I have missed out :(
Thank you.
Re: Is there a parent child heirarchy object?
You could use the "ForEach" object
And btw MMF2 automatically pairs objects, so
Always -> set turret to (0, 0) of Tank
will set all the turrets to 0, 0 of all the tanks (if there are enough turrets for each tank to have at least one
Re: Is there a parent child heirarchy object?
Quote:
Originally Posted by RickyRombo
Always -> set turret to (0, 0) of Tank
Careful with that; ive used it before and if you happen to have one more tank than turret, turrets will jump between tanks and cause a lot of pain.
I know coz tried to do space conquest thing before with revolving planets and buildings that stayed put on planets.
I had hangars flying through space...was bad
Re: Is there a parent child heirarchy object?
Quote:
Originally Posted by BAugustus
Quote:
Originally Posted by RickyRombo
Always -> set turret to (0, 0) of Tank
Careful with that; ive used it before and if you happen to have one more tank than turret, turrets will jump between tanks and cause a lot of pain.
I know coz tried to do space conquest thing before with revolving planets and buildings that stayed put on planets.
I had hangars flying through space...was bad
Thanks for the reply... yes I am actually having the same problem with the turrets jumping on different tanks. I am creating the parent and tanks realtime. What I am doing now is to assign the same ID in each tank and turret 'Alterable String'. So when building up the events it goes around...
ID of [turret] = ID of [tank]
where ID is an 'Alterable String'. Then move the turret to the new position relative to the tank :(
So far I have got it working ok but I am sure there is another way to just set the turret as child to parent? Else I will be adding stuffs like setting the rotation based on the parent and all. :(
Thank you for the replies... :D
Re: Is there a parent child heirarchy object?
I am actually trying to set names on created objects like when a new item is created, a name showing its a [Player 1 / Item 1] appear below the unit. :D
Re: Is there a parent child heirarchy object?
Ok I got it. For anyone interested in the solution which is nice :) It's actually here...
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=195402#Post1954 02
The title for the forum topic is "Matching up enemies with their own active objects".
Must have missed it the first time browsing through :D
Thanks :D
Re: Is there a parent child heirarchy object?
Uhm the way I've always done it is:
Number of "turret" objects < NObjects("tank")
-- Create "turret"
Number of "turret" objects > NObjects("tank")
+Pick "turret" at random
-- Destroy turret
Re: Is there a parent child heirarchy object?
Use instance selection and fatsloops to select each turret and tank correctly.
Use a similar technique that i was given in this MFA. It is VERY easily adapted to many situations to select objects based on spread values store in alterable values of the object(s) being selected.
Look at this MFA to see what i mean. I keep ALL example MFA's i find useful in a folder to reference to.
http://mfa.aquadasoft.com/view/1278562819-BoxInstanceTest_FIX
Re: Is there a parent child heirarchy object?
Thanks for the reply 'GameDevs'
I tried out the file and then realised I have not used any 'Spread' value before...
looked it up and proved to be quite useful :D
Though it does slowed down whenever I hit the BoxTester ... I guess it's because of the fastloop.
I will definately keep this one for reference :D Thanks again!
Re: Is there a parent child heirarchy object?
Quote:
Originally Posted by RickyRombo
Uhm the way I've always done it is:
Number of "turret" objects < NObjects("tank")
-- Create "turret"
Number of "turret" objects > NObjects("tank")
+Pick "turret" at random
-- Destroy turret
Yup got it Ricky :D
I was actually a bit confused at how this worked at first but then realised that MMF kept creating and deleting the turrets based on the number of tanks in the app.
Nice :D
Re: Is there a parent child heirarchy object?
Thanks :)
This is how I did my minimap widget :grin:
Re: Is there a parent child heirarchy object?
Oh well dont "create" turrets, just use an instance selection fastloop and copy/paste them otherwise it wont select them correctly.
Re: Is there a parent child heirarchy object?
When you get a "Slowdown" make sure its not looping or "extra loop calling" or the loop might be called more than its needed to. I have like 7 objects with multiples of 3 objects that use this fastloop instance selection and have no slowdowns. If you need to, change ordering of objects, or try to merge objects that depend off each other or something.
Re: Is there a parent child heirarchy object?
Quote:
Originally Posted by GameDevs
Oh well dont "create" turrets, just use an instance selection fastloop and copy/paste them otherwise it wont select them correctly.
GameDevs, that is exactly the same thing...
Re: Is there a parent child heirarchy object?
Oh sorry i meant dont use the function called "create object" in the event editor.
Re: Is there a parent child heirarchy object?
GameDevs I think you don't realise that that function only creates objects that were already in your game or app to begin with. It will just make another instance of the object like Control-Dragging an object or copy and pasting it.
Re: Is there a parent child heirarchy object?
oh ic, ya i knew it creates instances. I just wasn't sure if the spread values would be the same or if it wouldn't keep pairs and "easy" selection items.
Re: Is there a parent child heirarchy object?
You can "Always: Spread value" you know ;)
Re: Is there a parent child heirarchy object?
oh ya i guess you could spread the values as they are created. I guess. But then it can be hard to debug if something goes wrong if you are disorganized and have LOTS of code.