From 7b376fd3842c0366076a473cf7cffd8ba9bce5b8 Mon Sep 17 00:00:00 2001 From: geron-cn Date: Wed, 15 Apr 2015 13:32:04 +0800 Subject: [PATCH] fix action timeline step over frame when no (loop play && timespeed>1) --- .../ActionTimeline/CCActionTimeline.cpp | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp index 24b055574b..e399d86eee 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp @@ -199,22 +199,27 @@ void ActionTimeline::step(float delta) } _time += delta * _timeSpeed; - _currentFrame = (int)(_time / _frameInternal); - - stepToFrame(_currentFrame); - - if(_time > _endFrame * _frameInternal) + + if(_time < _endFrame * _frameInternal) + { + _currentFrame = (int)(_time / _frameInternal); + stepToFrame(_currentFrame); + } + else { if(_lastFrameListener != nullptr) _lastFrameListener(); - + _playing = _loop; if(!_playing) + { _time = _endFrame * _frameInternal; - else + _currentFrame = (int)(_time / _frameInternal); + stepToFrame(_currentFrame); + } + else gotoFrameAndPlay(_startFrame, _endFrame, _loop); } - } typedef std::function tCallBack;