Targeting certain game object?

I

Ieyfo

Guest
So in a nut shell i click two object and it stores the info then combines it to make a new object with the info, kinda like offspring if you will. The problem is it changes every object to have the new info, now i did some debugging and found the game does this because its has the same id and instance id how do i give each object its own id or instance_id because GMS isn't doing it like it should from my understanding.
 

Mornedil

Member
don't do something like:
Code:
with(obj_offspring) {
    //do stuff
}
it will change every single obj_offspring.

every instance has it's own unique ID, which you can use to only change a specific instance of an object, without affecting other instances of the same object.

If you're creating a new offspring object, you could do this:
Code:
var inst;
inst = instance_create(x, y, obj_offspring);
with(inst) {
    //do stuff and change variables, etc.
}
the temporary "inst" variable will store the id of the newly created obj_offspring, and then use it in the with statement.
Might not be exactly what you need, but hard to give more specific help without seeing what you're actually doing, heh.
 
Top