Parent Child Relationships

Non-platform specific questions.

Parent Child Relationships

Postby jazz_e_bob » Thu Aug 19, 2004 9:13 am

I have an enemy ship.

When the enemy ship is created it creates two child actors (guns).

You can shoot the guns leaving only the ship.

I want it so that when the last gun is destroyed the ship is destroyed.

How can an actor know if all of its children are dead?
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby makslane » Thu Aug 19, 2004 1:18 pm

Use Activation Events.

When a gun was destroyed, send a Activation Event to the parent.
On parent actor, set the event from Activation Event from "All Actors"

So, when all connected actors are destroyed, the parent can be destroyed.

To work, your childs must be created as clones into editor, not in a CreateActor call.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby jazz_e_bob » Thu Aug 19, 2004 7:50 pm

OK. Thanks. :)

Suggestion: :idea:

This is where I think a "parent" property might be handy.

On Destroy Gun
parent.guns -= 1;

Image
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby jazz_e_bob » Tue Aug 24, 2004 7:42 am

"parent" and "creator" properties.

It would make it faster to program complex actors.

I can just create a Destroyer and know that Destroyers will create it's own turrets.

I can now clone as many destroyers as I want and not have to worry about putting turrets on each one.

Nag Nag Nag I'm such a pushy bastard! :wink:

GE RULES
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby jazz_e_bob » Wed Aug 25, 2004 9:27 am

Add to typedef struct stActorVars

char name[PARENT_NAME]; //Parent name - returns 0 if no parent
char name[CREATOR_NAME]; //Creator name - returns 0 if created at startup

ENHANCED ACTOR INTERCONNECTIVITY! 8)

( Using Activation Events means that you have to build new actors everytime you build a new version of the same enemy. This is VERY time consuming. )

What do you think? :)
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby makslane » Thu Aug 26, 2004 1:17 pm

I think creator and parent actors will be nice :)
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest