Le Slo
Member
Hello!
I've been having troubles I don't really understand with the with statement and object parenting. Here is what I have:
-An obj_laser.
-An obj_laserAttack (child object of obj_laser).
So, I need to save the positions of those objects, and for that I use the following to save the positions:
So the logical thing to do is read the positions, when loading a game, the same way:
Well somehow that doesn't work! I need to specify a with statement for the obj_laserAttack for loading correctly their positions, but Ï don't need to add it to the saving function! What is going on here?!
I had this working not so long ago, without adding the with statement for obj_laserAttack, and I've messed with a lot of the code, something must had gone wrong, so my main question will be the following:
Are there ways of "deparenting" objects through code? It is possible to mess up with the with statement?
I've been having troubles I don't really understand with the with statement and object parenting. Here is what I have:
-An obj_laser.
-An obj_laserAttack (child object of obj_laser).
So, I need to save the positions of those objects, and for that I use the following to save the positions:
Code:
ini_open(argument[0]);
//Save the position of the lasers
with(obj_laser){
ini_write_real("LaserX",string(number),round(x/128)*128);
ini_write_real("LaserY",string(number),round(y/128)*128);
}
Code:
ini_open(argument[0]);
//Place the lasers in their saved position
with(obj_laser){
x=ini_read_real("LaserX",string(number),x);
y=ini_read_real("LaserY",string(number),y);
}
I had this working not so long ago, without adding the with statement for obj_laserAttack, and I've messed with a lot of the code, something must had gone wrong, so my main question will be the following:
Are there ways of "deparenting" objects through code? It is possible to mess up with the with statement?