obj_shipParent
| |
obj_enemy obj_ally----+
| | |
obj_enemyA obj_player obj_allyAi
| |
obj_enemyShip obj_AllyShip
That makes it tedious to code as obj_enemyAi and obj_allyAi are the very same (with a difference in whom it will attack).
Naturally, I want to make something more like:
obj_shipParent
| |
obj_enemy obj_ally
\ |
obj_ai obj_player
|
obj_Ship
In this case, obj_ai is switchable. When the obj_ship is created it is by default branching to obj_enemy.I would like the program sets 'obj_Ship's' parent, 'obj_ai' to have the parent 'obj_ally'.
obj_shipParent
| |
obj_enemy obj_ally
/ |
obj_ai obj_player
|
obj_Ship
---------------------I have tried some convoluted code:
with (instance_create(destination_x+16,destination_y+16,obj_ship))
{
object_set_parent(object_get_parent(id),obj_allied);
sprite_index = spr_enemy2;
my_enemy = obj_enemy;
};
};
When I do this, the ai is very confused as to whom it should be shooting at. It will shoot at the enemy, but also intermittently its allies.Clearly I don't understand how the functions work...
I was wondering if there is a way to do this, or if I am going about it all wrong and should be using a better concept for my ai structure.
Should I just put obj_player at the bottom of the pile and call events from obj_ship directly?
I am so confused...
Thanks!
---Edited to change some inaccuracies--
--Realized this should probably be in novice/Intermediate users--- Man, I suck at making topics.
Edited by C_Pike, 29 April 2012 - 06:01 PM.











