hi
What are your advices or tricks for new parent assignment to a Sprites and the opportunity to return to the original parent.
example:
to change parent i do this
For the moment I do as like this for keep the original parent sprites.
But I am not sure of the validity of this procedure.
so when delete picture
Is there a way to go back (set Back) to the original parent, without making a total copy, for performance reasons?
Or can you confirm that this is the right ways to do?
thanks in advance for your suggestions
What are your advices or tricks for new parent assignment to a Sprites and the opportunity to return to the original parent.
example:
to change parent i do this
PHP:
Game_Picture.prototype.spine = function(id){
var newParent = SceneManager._scene._spriteset._pictureContainer.children[id-1];
var targetSprite= SceneManager._scene._spriteset._pictureContainer.children[this._PID-1];
targetSprite.parent=newParent;
return this
};
For the moment I do as like this for keep the original parent sprites.
But I am not sure of the validity of this procedure.
PHP:
Game_Picture.prototype.spine = function(id){
var newParent = SceneManager._scene._spriteset._pictureContainer.children[id-1];
var targetSprite= SceneManager._scene._spriteset._pictureContainer.children[this._PID-1];
targetSprite.originalParent = targetSprite.parent; // store Original parent in originalParent , for comeBack if need !
targetSprite.parent=newParent;
return this
};
so when delete picture
PHP:
Game_Screen.prototype.erasePicture = function(pId) {
this._pictures[pId] = undefined;
var pictureChild = SceneManager._scene._spriteset._pictureContainer.children[pId-1];
if(pictureChild.originalParent){// reset to original parent // TODO: check other way if possible
pictureChild.parent = pictureChild.originalParent;
}
};
Is there a way to go back (set Back) to the original parent, without making a total copy, for performance reasons?
Or can you confirm that this is the right ways to do?
thanks in advance for your suggestions

