學習貪吃蛇JS專案實戰筆記2
阿新 • • 發佈:2019-01-26
cc.MoveTo._create = cc.MoveTo.create; cc.moveTo = cc.MoveTo.create = function(duration, posOrX, y){ if (undefined === y){ return cc.MoveTo._create(duration, posOrX); }else{ return cc.MoveTo._create(duration, cc.p(posOrX, y)); } }; cc.MoveBy._create = cc.MoveBy.create; cc.moveBy = cc.MoveBy.create = function(duration, posOrX, y){ if (undefined === y){ return cc.MoveBy._create(duration, posOrX); }else{ return cc.MoveBy._create(duration, cc.p(posOrX, y)); } }; cc.JumpTo._create = cc.JumpTo.create; cc.jumpTo = cc.JumpTo.create = function(duration, position, y, height, jumps){ if (undefined === jumps){ jumps = height; height = y; return cc.JumpTo._create(duration, position, height, jumps); }else{ return cc.JumpTo._create(duration, cc.p(position, y), height, jumps); } }; cc.JumpBy._create = cc.JumpBy.create; cc.jumpBy = cc.JumpBy.create = function(duration, position, y, height, jumps){ if (undefined === jumps){ jumps = height; height = y; return cc.JumpBy._create(duration, position, height, jumps); }else{ return cc.JumpBy._create(duration, cc.p(position, y), height, jumps); } };