jonassode/gamejs — Issue #24: Deep Copy Of Nodes
Author: jonassode
Created: 2011-10-27 15:32:32+00:00
State: open

Class: _tilemap_class
Method: .place
Row: 820

When background nodes are placed on the board the function _tilemap_class.place is used.
But there is a problem with this function since it only copies the objects that are are default node objects.

We need to have a deep copy that also copies game specific objects

Exampel

a = tilemap._tile(...)
a.text = "ninja"
a.func = function(){ alert('my fucntion'); }

tilemap.place(1,2,a)
tilemap.background(1,2).func()
// this last row should work

I tired a recursive deep copy of all objects in the node but it gave me problems since there are lots of back-references in the Node ( to tilemap and such )