On Monday, April 9, 2012 3:54:36 AM UTC-5, Claudio Canepa wrote:
>
>
>
> On Mon, Apr 9, 2012 at 5:21 AM, Oninoshiko <[email protected]> wrote:
>
>> I'm putting together a pair of InstantActions to solve the problem
>> where you want to change Scenes after the action completes. I'm
>> calling the ScenePop and SceneReplace.
>>
>> ScenePop works like a charm.
>>
>> SceneReplace, on the other hand, does not. It thows an error about a
>> deepcopy failing when I try to pass in the scene I want to replace the
>> current one with. Honestly, I'm not sure why it would need a deep copy
>> in this case rather then just passing a reference (is there a way to
>> force that behavior?),
>>
>> I'm using Cocos2d 0.5 and Python 2.6.6
>>
>> --
>
>
> It is a limitation in current design. They are some workaounds, like store
> the reference in the action target, or pass the reference you want not
> deepcopied as an action.init2 method to be called as in
> template_action = MyAction()
> worker_action = node.do(template_action)
> worker_action.init2( param_to_not_deepcopy)
>
> The last workaround can be seen in the test\test_action_non_interval.py
> example.
>
> I you show code maybe a more specific workaround can be sugested.
>
> --
> claudio
>
>
Of course! What I have is this:
class ReplaceScene(InstantAction):
def init(self, newscene):
self.newscene = newscene
def start(self):
director.replace(self.newscene)
Ideally, I just want to be able to add "ReplaceAction(Scene(layer))" to
the end of a Action sequence.
--
You received this message because you are subscribed to the Google Groups
"cocos2d discuss" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/cocos-discuss/-/3ciMoV3SlMIJ.
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.