Skip to content

Commit d53d708

Browse files
author
SeanLin
committed
Merge pull request cocos2d#552 from dingpinglv/iss1346_PortActions
fixed cocos2d#1346 modify code for Animate and fix bug for cc.Rect
2 parents 0ed19a4 + e0d22c9 commit d53d708

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

cocos2d/actions/CCActionInterval.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,7 +1941,7 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{
19411941
},
19421942

19431943
/**
1944-
* @param {cc.Node} target
1944+
* @param {cc.Sprite} target
19451945
*/
19461946
startWithTarget:function (target) {
19471947
//this._super(target);
@@ -1975,20 +1975,15 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{
19751975

19761976
var frames = this._animation.getFrames();
19771977
var numberOfFrames = frames.length;
1978-
var frameToDisplay = null;
19791978

19801979
for (var i = this._nextFrame; i < numberOfFrames; i++) {
1981-
var splitTime = this._splitTimes[i];
1980+
if (this._splitTimes[i] <= time) {
1981+
this._target.setDisplayFrame(frames[i].getSpriteFrame());
19821982

1983-
if (splitTime <= time) {
1984-
var frame = frames[i];
1985-
frameToDisplay = frame.getSpriteFrame();
1986-
this._target.setDisplayFrame(frameToDisplay);
1987-
1988-
var dict = frame.getUserInfo();
1989-
if (dict) {
1983+
//var dict = frame.getUserInfo();
1984+
//if (dict) {
19901985
//TODO: [[NSNotificationCenter defaultCenter] postNotificationName:CCAnimationFrameDisplayedNotification object:target_ userInfo:dict];
1991-
}
1986+
//}
19921987
this._nextFrame = i + 1;
19931988
break;
19941989
}

cocos2d/cocoa/CCGeometry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ cc.Rect.CCRectGetMaxX = function (rect) {
171171
* Constructor
172172
*/
173173
cc.Rect.CCRectGetMidX = function (rect) {
174-
return ((rect.origin.x + rect.size.width) / 2.0);
174+
return (rect.origin.x + rect.size.width / 2.0);
175175
};
176176
/**
177177
* return the leftmost x-value of 'rect'

0 commit comments

Comments
 (0)