Hi Claudio,
Thanks for the suggestion.
It somehow feels *wrong* to me. Not that it wouldn't work. But it's not
very scalable. My example is obviously a bit contrived. But imagine you
want to script a scenary. There might be something like 5 different actors
in play, all doing things in a pre-determined sequence. It feels kind of
odd to add a Delay action to wait for another actor (cocosnode) to finish
its action. Besides, talking about scalability, what if all of a sudden,
there is an action which speeds up a previous action. The Delay won't be
synchronized anymore.
I was looking at the Sequence_IntervalAction and was thinking about how the
actions get sequenced. What if now the layer or the scene containing the
different actors had an action which allowed to sequence actions with
different targets. Let's call this Sequence_Targets_IntervalAction You
could then write something like:
actions_sequence = [ MoveTo(sp2.position, 5) + Say("Where should I go ?",
3),
Say("Go to the bottom right corner", 3),
MoveTo(right_corner, 5)
]
scene.do(Sequence_Targets_IntervalAction(actions_sequence), target=(sp1,
sp2, sp1))
This action would take each action in the actions_sequence and assign the
corresponding targer to it. It would wait for the first action to complete
before moving on the next one.
It's just a thought. It might break other things. Obviously
Sequence_Targets_IntervalAction must have the same length of actions as
target.
Your thoughts?
Am I doing this too complicated?
Thanks for your help!
Daniel.
On Saturday, November 2, 2013 2:32:31 PM UTC+1, Claudio Canepa wrote:
>
>
>
>
> On Sat, Nov 2, 2013 at 4:44 AM, Daniel Gillet
> <[email protected]<javascript:>
> > wrote:
>
>> Hello,
>>
>> I would like to chain some actions for multiple targets. Say I want to do
>> a little animation with two sprites:
>> 1. Sprite1 moves next to Sprite2 in 5 sec.
>> 2. Sprite1 says: "Where should I go?" for 3 sec.
>> 3. Sprite2 says: "Go to the bottom right corner." for 3 sec.
>> 4. Sprite 1 moves to the bottom right corner in 5 sec.
>>
>> And let's just assume there is an action to say something (not relevant
>> for what I'm trying to figure out).
>>
>>
>>
> If by say you are talking about to something akin a print, this should
> work
>
> action_template1 = ( MoveTo(sp2.position, 5) +
> CallFunc(say, "Where should I go ?") +
> Delay(3) +
> MoveTo(right_corner, 5)
> )
>
> action_template2 = ( Delay(8) +
> CallFunc(say, "Go to the bottom right
> corner")
> )
>
>
>
--
You received this message because you are subscribed to the Google Groups
"cocos2d discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cocos-discuss.
For more options, visit https://groups.google.com/groups/opt_out.