File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1073,7 +1073,7 @@ cc.JumpBy = cc.ActionInterval.extend(/** @lends cc.JumpBy# */{
1073
1073
*/
1074
1074
startWithTarget :function ( target ) {
1075
1075
cc . ActionInterval . prototype . startWithTarget . call ( this , target ) ;
1076
- this . _startPosition = target . getPosition ( ) ;
1076
+ this . _previousPosition = this . _startPosition = target . getPosition ( ) ;
1077
1077
} ,
1078
1078
1079
1079
/**
@@ -1084,8 +1084,16 @@ cc.JumpBy = cc.ActionInterval.extend(/** @lends cc.JumpBy# */{
1084
1084
var frac = time * this . _jumps % 1.0 ;
1085
1085
var y = this . _height * 4 * frac * ( 1 - frac ) ;
1086
1086
y += this . _delta . y * time ;
1087
+
1087
1088
var x = this . _delta . x * time ;
1088
- this . _target . setPosition ( cc . p ( this . _startPosition . x + x , this . _startPosition . y + y ) ) ;
1089
+
1090
+ var currentPos = this . _target . getPosition ( ) ;
1091
+
1092
+ var diff = cc . pSub ( currentPos , this . _previousPosition ) ;
1093
+ this . _startPosition = cc . pAdd ( diff , this . _startPosition ) ;
1094
+ var newPos = cc . pAdd ( this . _startPosition , cc . p ( x , y ) ) ;
1095
+ this . _target . setPosition ( newPos ) ;
1096
+ this . _previousPosition = newPos ;
1089
1097
}
1090
1098
} ,
1091
1099
Original file line number Diff line number Diff line change @@ -98,7 +98,6 @@ cc.ActionManager = cc.Class.extend({
98
98
}
99
99
//creates a array for that eleemnt to hold the actions
100
100
this . _actionAllocWithHashElement ( element ) ;
101
- cc . Assert ( ( element . actions . indexOf ( action ) == - 1 ) , "ActionManager.addAction()," ) ;
102
101
103
102
element . actions . push ( action ) ;
104
103
action . startWithTarget ( target ) ;
You can’t perform that action at this time.
0 commit comments