>Is there a way to not interrupt the current action and run the second
action in parallel with the rest of the current one?

Not with the current codebase.
See 
api/cocos.actions.base_actions.html#restrictions-and-capabilities-for-the-current-design-and-implementation
(you need to build the docs, I don't have a live link now, sorry)

There you can see an inspiration for a possible workaround: look at
class MoveByAdditive, if you write a JumpAdditive then it can compose with
another additive or instant action as you described,

Not ideal but the most immediate solution.


Long term, maybe a new action operation over Actions could be defined
      worker_action = actor.do(Jump(...))
      actor.do(Modify( worker_action,  fn_my_action_patcher)

where Modify should extract init params from the worker action, calculate
remaining_duration, call the user provided   fn_my_action_patcher with
those params,  the fn must return the desired composition.

Looks not easy to use, but maybe some experimentation can produce something
viable.




On Sun, Nov 1, 2020 at 12:21 PM Facundo Batista <facundobati...@gmail.com>
wrote:

> Hello!
>
> I want the effect of "composing" a second action with the current
> one... I'll describe an example to show that better:
>
> I press UP and my sprite will jump (I'm using JumpBy for this), and in
> the middle of the jump, I press RIGHT and I want to move the sprite
> some pixels to the right, in the middle of the jump!
>
> IOW, the sequence would be something like (showing simple X Y of the
> sprite)
>
> Just jumping:
>
> - t0: 0, 0
> - UP
> - t1: 0, 2
> - t2: 0, 3
> - t3: 0, 2
> - t4: 0, 0
>
> Pressing RIGHT in the middle of the jump:
>
> - t0: 0, 0
> - UP
> - t1: 0, 2
> - t2: 0, 3
> - RIGHT
> - t3: 1, 2
> - t4: 1, 0
>
> My problem is that when doing mysprit.do(MoveBy((1, 0), 0)) when the
> use presses RIGHT it *interrupts* the jump.
>
> Is there a way to not interrupt the current action and run the second
> action in parallel with the rest of the current one?
>
> Thanks!
>
> --
> .    Facundo
>
> Blog: http://www.taniquetil.com.ar/plog/
> PyAr: http://www.python.org.ar/
> Twitter: @facundobatista
>
> --
> 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 cocos-discuss+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/cocos-discuss/CAM09pzQkvJQ-t%2BzL1ZaMV%2BKgWpEs%2B2trrtZB5cAauJOpd4XR8g%40mail.gmail.com
> .
>

-- 
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 cocos-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cocos-discuss/CAP3BN9WpuGsnGZBz130gtDWHvVdykpUhSUGfUeKWgfUBX7CAag%40mail.gmail.com.

Reply via email to