Posted By: wrekWIRED
passing pointer to action/function? - 11/04/13 16:05
I'm making an entity with multiple body parts. Basically the parent body creates it's child part.
something like this.
now the code just throws undeclared identifier for parent_ent. Reason for each body processing it's child part it because I'm spawning multiple entities of the same type each creating it's own parts and each part updates base on it's own parent entity.
What am I doing wrong it this case?
something like this.
Code:
action body_action() action child_action() ENTITY* body = ent_create(body, pos, body_action); //main body action action body_action() { //msc codes here code... //create child entity ent_create(part1, pos_parentoffset, child_action(me)); //point me as parent entity //rest of the child entity code code... } //child body action action child_action(ENTITY* parent_ent) { //msc codes here code... while(1) { //parent_ent pointing to main body vec_set(my.x, parent_ent.x); wait(1); } }
now the code just throws undeclared identifier for parent_ent. Reason for each body processing it's child part it because I'm spawning multiple entities of the same type each creating it's own parts and each part updates base on it's own parent entity.
What am I doing wrong it this case?