通过下列代码使用actionTimeline问题的时候
auto atl = CSLoader::createTimeline("barbarian_attackright.csb");
this->sprite->runAction(atl);
atl->gotoFrameAndPlay(0, true);
PositionFrame::onEnter函数老是出现EXC_BAD_ACCESS(CODE=2 ADDRESS=0X0), _node是等于NULL的, 不知道为什么,自己的文件路径什么的都没有问题。
void PositionFrame::onEnter(Frame *nextFrame)
{
_node->setPosition(_position); // EXC_BAD_ACCESS(CODE=2 ADDRESS=0X0)
if(_tween)
{
_betweenX = static_cast<PositionFrame*>(nextFrame)->_position.x - _position.x;
_betweenY = static_cast<PositionFrame*>(nextFrame)->_position.y - _position.y;
}
}
console的输出结果也没有什么问题
cocos2d: suffix = csb
cocos2d: frameType = PositionFrame
cocos2d: x = 5.834900
cocos2d: y = 33.452801
cocos2d: x = 13.226400
cocos2d: y = 37.953701
cocos2d: x = 4.863600
cocos2d: y = 41.454601
cocos2d: x = -1.399700
cocos2d: y = 38.472500
cocos2d: x = 13.459600
cocos2d: y = 42.789101
cocos2d: x = 25.984699
cocos2d: y = 34.619999
cocos2d: x = -0.777300
cocos2d: y = 22.394600
cocos2d: x = -3.500100
cocos2d: y = 23.005699
cocos2d: frameType = ScaleFrame
cocos2d: scalex = 1.000000
cocos2d: scaley = 1.000000
cocos2d: frameType = RotationSkewFrame
cocos2d: frameType = TextureFrame
cocos2d: texture = x_attackright_0.png
cocos2d: texture = x_attackright_1.png
cocos2d: texture = x_attackright_2.png
cocos2d: texture = x_attackright_3.png
cocos2d: texture = x_attackright_4.png
cocos2d: texture = x_attackright_5.png
cocos2d: texture = x_attackright_6.png
cocos2d: texture = x_attackright_7.png
不知道问题出在什么地方