L
leuchtstein
Guest
Hello. I have an object, a turret from a tank. On creation it does
Basically, obj_entity is the parent of all players, enemies or other AI. I want to something in the Step Event depending on what type of object the "parent" variable is.
For example:
I have obj_enemy, which is the parent of all enemy objects
I have obj_allied, which is the parent of all allied objects
I have obj_player, which is the player
I now want, if "parent" is for example an obj_enemy, it should do different things than if it is an obj_allied (Allied should shoot enemy, and reverse, as it is a turret)
But using simply
or something like that doesnt work
I also tried working with object_index and object_get_name, but it didn´t work.
I have the object ID in the parent variable, I thought I can do something with it, but I can´t figure anything out.
Can anybody help me? Thanks.
( I am using GameMaker 8.1 )
Code:
parent = instance_nearest(x,y,obj_entity)
For example:
I have obj_enemy, which is the parent of all enemy objects
I have obj_allied, which is the parent of all allied objects
I have obj_player, which is the player
I now want, if "parent" is for example an obj_enemy, it should do different things than if it is an obj_allied (Allied should shoot enemy, and reverse, as it is a turret)
But using simply
Code:
if parent == obj_enemy
I also tried working with object_index and object_get_name, but it didn´t work.
I have the object ID in the parent variable, I thought I can do something with it, but I can´t figure anything out.
Can anybody help me? Thanks.
( I am using GameMaker 8.1 )