DeadSigilGames
Member
Hello!
I've been struggling a bit on understanding how to manipulate and instance objects on multiple instances of my enemies.
Basically i'm trying to create a secondary collision mask that follows them locked to their x, y.
if (!instance_exists(obj_M_Collider)) {
with(obj_Monster_Parent) {
instance_create_depth(x, y, 0, obj_M_Collider);
}
}
with (obj_Monster_Parent) {
obj_M_Collider.x = x;
obj_M_Collider.y = y;
}
My if statement works fine, since it creates the "obj_M_Collider" on the x, y of each enemy on the room, however i don't know how to proceed because when i declare that the mask is tied to their x, y, all the created masks gets tied to the last enemy instance in the room.
I'm storing most of the monster basic codes on the obj_Monster_Parent since it's something all the monsters in the game will have and it seems to be the right way to do it instead of putting this same code on every single monster i think. (Except for bosses wich i'll use another Parent).
I tried to do this in many ways and still didn't found an answer, neither on the internet, i found many posts talking about this kind of stuff, that you need to make game maker understand each instance separatedly, but didn't found anyone talking about how i should proceed or what logic i should use.
Any help is welcome!
I've been struggling a bit on understanding how to manipulate and instance objects on multiple instances of my enemies.
Basically i'm trying to create a secondary collision mask that follows them locked to their x, y.
if (!instance_exists(obj_M_Collider)) {
with(obj_Monster_Parent) {
instance_create_depth(x, y, 0, obj_M_Collider);
}
}
with (obj_Monster_Parent) {
obj_M_Collider.x = x;
obj_M_Collider.y = y;
}
My if statement works fine, since it creates the "obj_M_Collider" on the x, y of each enemy on the room, however i don't know how to proceed because when i declare that the mask is tied to their x, y, all the created masks gets tied to the last enemy instance in the room.
I'm storing most of the monster basic codes on the obj_Monster_Parent since it's something all the monsters in the game will have and it seems to be the right way to do it instead of putting this same code on every single monster i think. (Except for bosses wich i'll use another Parent).
I tried to do this in many ways and still didn't found an answer, neither on the internet, i found many posts talking about this kind of stuff, that you need to make game maker understand each instance separatedly, but didn't found anyone talking about how i should proceed or what logic i should use.
Any help is welcome!