if actor is parent

Non-platform specific questions.

if actor is parent

Postby mrgame » Thu Jan 24, 2008 7:43 pm

i need a way to do this.
eg
if (actor1 is child of actor2)
{
ect ect ect
}
any ideas?

little more info.
i need it so if say the engine is attached to the car the car can move. if the engine isnt attached it wont move. but i need to be able to dublicate engine and car and if i attach the engine to 1 car only that car will move. or if i attach to both they both will move.
THEY ATTACH by if they touch each other the engine becomes a child of the car
then if i click on the engine it become not an child and falls of.
mrgame
 
Posts: 118
Joined: Sun Oct 21, 2007 8:09 pm
Location: my computer
Score: 3 Give a positive score

Re: if actor is parent

Postby Kalladdolf » Thu Jan 24, 2008 8:09 pm

I think there's no way around using variables =(
so basically when you drag the engine to the car 1:
Code: Select all
car1.attach = 1;
//change parent

and then when you wanna drive (this goes for car):
Code: Select all
if(attatch == 1)
{//drive;}

then when you remove the engine:
Code: Select all
car1.attatch = 0;
//change parent


note that attach is an actor vaiable, because you wanna do it with other cars as well, right? =D

ok, try this code, I've wrote it in a hurry, hope it works.
=D
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: if actor is parent

Postby Bee-Ant » Sun Jan 27, 2008 7:33 am

Code: Select all
if(parent==1)
{
    //change parent to any actor
    parentevent=1;
}
if(parent==0)
{
    //change parent to none
    parentevent=0;
}
if(parentevent==1)
{
    //event while parented
}
if(parentevent==0)
{
    //event while not parented
}
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron