On Fri, Sep 24, 2010 at 1:02 AM, Mike Wyatt <[email protected]> wrote:
> CocosNode's do() function does a deep copy of the action. This is
> causing a problem with my AStarMove action, which takes a reference to
> an A* node graph. For a larger graph (like 64x64 cells in a grid),
> the recursive copy hits the max recursion limit and throws an
> exception.
>
> So, what is the best way to avoid this? Can the deep copy be made
> optional, or is there an important reason for it to always happen?
>
> Or, I could attach the graph object after calling do(), but that seems
> hacky.
>
> Thoughts?
>
>
Possible workarounds, choose one:
1. pass things that you don't want deep copied in a init2, like this:
template_action = MyAction()
worker_action = node.do(template_action)
worker_action.init2(reference)
look at test/test_action_non_interval.py for an example;
2. Write the code in your action like the reference needed is stored in the
cocosnode. to start such an action you go like
node.reference = whatever
node.do(MyAction())
There is an opportunity to redesign cocos actions here, and I will comment
in another post.
--
claudio
--
You received this message because you are subscribed to the Google Groups
"cocos2d discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cocos-discuss?hl=en.