MoveTo 动作反向reverse 问题

我看了下MoveTo 的 reverse() 方法,是继承至 MoveBy 的,如果MoveTo 起点是(0,0)点,再调用reverse() 方法,获取到反向动作。
现在的问题来了,其实内部创建的是一个MoveBy 动作,导致反向无效!

这个是未知bug,还是我的理解有误,望指导下正确的做法。

看了下源码,必须得手动调一下startWithTarget,绑定对象,才能获得逆动作的终点。

不过这也够蛋疼的。如果不调用startWithTarget的话,x中很多位置信息都是空值,这会导致获取y时出异常。

MoveTo* x = MoveTo::create(1, Vec2(100,100));

x->startWithTarget(sprite);

MoveBy* y = x->reverse();

sprite->runAction(Sequence::create(x, y, NULL));

我还是建了个issue。

https://github.com/cocos2d/cocos2d-x/issues/10589

你关注下这个issue吧。

reverse()不支持移动

Assert failed: reverse() not supported in MoveTo
Assertion failed!

Program: F:\cz\event\Debug.win32\libcocos2d.dll
File: CCActionInterval.cpp
Line: 1176

Expression: false

For information on how your program can cause an assertion
failure, see the Vis