R
renfors
Guest
Hi
I'm creating an object with instance_create_layer that I later want to update with "with".
If I do the update in the same loop-iteration, the object is moved. However, a new instance is created if I do the update in a later iteration.
if(stepNumber == 1)
{
tilePosX = 50
tilePosY = 50
inst = instance_create_layer(tilePosX, tilePosY, "Instances", object5)
}
if(stepNumber == 2)
{
tilePosX = 100
tilePosY = 100
with(inst)
{
y = other.tilePosY
x = other.tilePosX
}
}
stepNumber++
If I change the second IF-statement in the code above to "stepNumber == 1", the instance is correctly moved instead of having a new one created in the new position. How can i update instances with "with" without having them duplicated?
I'm creating an object with instance_create_layer that I later want to update with "with".
If I do the update in the same loop-iteration, the object is moved. However, a new instance is created if I do the update in a later iteration.
if(stepNumber == 1)
{
tilePosX = 50
tilePosY = 50
inst = instance_create_layer(tilePosX, tilePosY, "Instances", object5)
}
if(stepNumber == 2)
{
tilePosX = 100
tilePosY = 100
with(inst)
{
y = other.tilePosY
x = other.tilePosX
}
}
stepNumber++
If I change the second IF-statement in the code above to "stepNumber == 1", the instance is correctly moved instead of having a new one created in the new position. How can i update instances with "with" without having them duplicated?