I’ve seen plenty of examples of where you want to override an existing object by making it something else. For instance, the original Retina Text work around:
orignalNewText = display.newText
display.newText = function()
-- do some stuff
originalNewText(blah blah blah)
end
So I need to “morph” my avatar in a game from one display object to another. But this behavior doesn’t seem to be working the way I expect it too…
function swapPlayer()
local oldPlayer = player
player = newPlayer
oldPlayer:removeSelf()
oldPlayer = nil
end
player and newPlayer are both movieclip.newAnim’s.
So the way I understand it, since these are all just pointers, oldPlayer should hold the player object. Then player will hold my newplayer and I should be able to safely dispose of oldPlayer.
But as soon as I do the :removeSelf() on oldPlayer, both of my objects go away.
Any thoughts on this?
[import]uid: 19626 topic_id: 22095 reply_id: 322095[/import]

