資料來源: 千鋒獨家出品《Android遊戲開發基礎視頻教程》http://www.mobiletrain.org/about/news/android_video3.html
* CCFadeIn 與 CCFadeOut
CCFadeIn ccFadeIn = CCFadeIn.action(3);
player.runAction(ccFadeIn);
CCFadeOut ccFadeOut = CCFadeOut.action(3);
player.runAction(ccFadeOut);
* CCTintTo 與 CCTintBy
ccColor3B color3b = ccColor3B.ccc3(0, 0, 255);
CCTintTo ccTintTo = CCTintTo.action(3, color3b);
player.runAction(ccTintTo);
ccColor3B color3b = ccColor3B.ccc3(-120, -255, -120);
CCTintBy ccTintBy = CCTintBy.action(3, color3b);
player.runAction(ccTintBy);
* CCRepeat
CGPoint cgPoint = CGPoint.ccp(100, 300);
CGPoint targetPoint = CGPoint.ccp(400, 300);
CCMoveTo moveTo1 = CCMoveTo.action(2, targetPoint);
CCMoveTo moveTo2 = CCMoveTo.action(2, cgPoint);
CCSequence ccSequence = CCSequence.actions(moveTo1, moveTo2);
CCRepeat ccRepeat = CCRepeat.action(ccSequence, 3);
player.runAction(ccRepeat);
* CCRepeatForever
CCRepeatForever ccRepeatForever = CCRepeatForever.action(ccSequence);
player.runAction(ccRepeatForever);
Saturday, May 16, 2015
Thursday, May 14, 2015
Priority inversion learning note
* Bounded priority inversion

* Unbounded priority inversion

How to solve
* Priority inheritance protocol
Raised the low priority task which locked shared resource to high priority to finish task and release shared resource soon.
* Priority ceiling protocol
** OCPP: Original Ceiling Priority Protocol
Raised the task (locked resource) priority to high priority when another task tries to acquire shared resource.
** ICPP: Immediate Ceiling Priority Protocol
Raised the task priority to high priority when it acquires resource.
Reference:
http://en.wikipedia.org/wiki/Priority_inheritance
http://en.wikipedia.org/wiki/Priority_ceiling_protocol
http://blog.linux.org.tw/~jserv/archives/001299.html
http://oss.org.cn/ossdocs/rt_embed/rt/priority.html
http://wen00072-blog.logdown.com/posts/183461-note-priority-inversion-on-mars
http://www.embedded.com/design/configurable-systems/4024970/How-to-use-priority-inheritance

* Unbounded priority inversion

How to solve
* Priority inheritance protocol
Raised the low priority task which locked shared resource to high priority to finish task and release shared resource soon.
* Priority ceiling protocol
** OCPP: Original Ceiling Priority Protocol
Raised the task (locked resource) priority to high priority when another task tries to acquire shared resource.
** ICPP: Immediate Ceiling Priority Protocol
Raised the task priority to high priority when it acquires resource.
Reference:
http://en.wikipedia.org/wiki/Priority_inheritance
http://en.wikipedia.org/wiki/Priority_ceiling_protocol
http://blog.linux.org.tw/~jserv/archives/001299.html
http://oss.org.cn/ossdocs/rt_embed/rt/priority.html
http://wen00072-blog.logdown.com/posts/183461-note-priority-inversion-on-mars
http://www.embedded.com/design/configurable-systems/4024970/How-to-use-priority-inheritance
cocos2d android Java 游戲開發基礎 7 - CCAction 初步 (三) 學習視頻筆記
資料來源: 千鋒獨家出品《Android遊戲開發基礎視頻教程》http://www.mobiletrain.org/about/news/android_video3.html
* CCSequence 的使用方法
** 一連串的動作依序執行
CGPoint targetPoint = CGPoint.ccp(500, 500);
CCMoveTo moveTo = CCMoveTo.action(5, targetPoint);
CCRotateTo rotateTo = CCRotateTo.action(5, 180);
CCScaleTo scaleTo = CCScaleTo.action(2, 2);
CCSequence ccSequence = CCSequence.actions(moveTo, rotateTo, scaleTo);
player.runAction(ccSequence);
* CCSpawn 的使用方法
** 一連串的動作同時間執行
CCSpawn ccSpawn = CCSpawn.actions(moveTo, rotateTo, scaleTo);
player.runAction(ccSpawn);
* CCCallfuncN 的使用方法
** 用於一個動作作完後所要執行的動作
CCCallFuncN funcN = CCCallFuncN.action(this, "onActionFinished");
player.runAction(funcN);
* CCFollow 的使用方法
CCFollow ccFollow = CCFollow.action(followedNode, rect);
player.runAction(ccFollow);
* 總結
* CCSequence 的使用方法
** 一連串的動作依序執行
CGPoint targetPoint = CGPoint.ccp(500, 500);
CCMoveTo moveTo = CCMoveTo.action(5, targetPoint);
CCRotateTo rotateTo = CCRotateTo.action(5, 180);
CCScaleTo scaleTo = CCScaleTo.action(2, 2);
CCSequence ccSequence = CCSequence.actions(moveTo, rotateTo, scaleTo);
player.runAction(ccSequence);
* CCSpawn 的使用方法
** 一連串的動作同時間執行
CCSpawn ccSpawn = CCSpawn.actions(moveTo, rotateTo, scaleTo);
player.runAction(ccSpawn);
* CCCallfuncN 的使用方法
** 用於一個動作作完後所要執行的動作
CCCallFuncN funcN = CCCallFuncN.action(this, "onActionFinished");
player.runAction(funcN);
* CCFollow 的使用方法
CCFollow ccFollow = CCFollow.action(followedNode, rect);
player.runAction(ccFollow);
* 總結
cocos2d android Java 游戲開發基礎 6 - CCAction 初步 (二) 學習視頻筆記
資料來源: 千鋒獨家出品《Android遊戲開發基礎視頻教程》http://www.mobiletrain.org/about/news/android_video3.html
* 什麼是向量
* 基于向量的計算
** 向量的加減法
CGPoint deltaPoint = CGPoint.ccp(0, 200);
CGPoint targetPoint = CGPoint.ccpAdd(cgPoint, deltaPoint);
CGPoint subPoint = CGPoint.ccp(200, 300);
CGPoint tgPoint = CGPoint.ccpSub(targetPoint, subPoint);
** 向量的乘除法
CGPoint newPoint = CGPoint.ccpMult(tgPoint, 2);
** 計算單位向量
* 使用 CGPoint 對象代表向量
CGPoint anotherPoint = CGPoint.ccpNormalize(tgPoint);
* 基于向量的運算
* CCMoveBy 與 CCJumpBy
CGPoint onePoint = CGPoint.ccp(500, 300);
CCMoveBy moveBy = CCMoveBy.action(5, onePoint);
CGPoint jumpPoint = CGPoint.ccp(300, 100);
CCJumpBy jumpBy = CCJumpBy.action(5, deltaPoint, 500, 5);
* 總結
* 什麼是向量
* 基于向量的計算
** 向量的加減法
CGPoint deltaPoint = CGPoint.ccp(0, 200);
CGPoint targetPoint = CGPoint.ccpAdd(cgPoint, deltaPoint);
CGPoint subPoint = CGPoint.ccp(200, 300);
CGPoint tgPoint = CGPoint.ccpSub(targetPoint, subPoint);
** 向量的乘除法
CGPoint newPoint = CGPoint.ccpMult(tgPoint, 2);
** 計算單位向量
* 使用 CGPoint 對象代表向量
CGPoint anotherPoint = CGPoint.ccpNormalize(tgPoint);
* 基于向量的運算
* CCMoveBy 與 CCJumpBy
CGPoint onePoint = CGPoint.ccp(500, 300);
CCMoveBy moveBy = CCMoveBy.action(5, onePoint);
CGPoint jumpPoint = CGPoint.ccp(300, 100);
CCJumpBy jumpBy = CCJumpBy.action(5, deltaPoint, 500, 5);
* 總結
Tuesday, May 12, 2015
cocos2d android Java 游戲開發基礎 5 - CCAction 初步 (一) 學習視頻筆記
資料來源: 千鋒獨家出品《Android遊戲開發基礎視頻教程》http://www.mobiletrain.org/about/news/android_video3.html
* 動作類的基本概念
** 動作類對象通常不會單獨存在
** 動作類對象需要作用在精靈,圖層等對象上才能發揮作用
** 動作類包含有很多種類型,例如位移,縮放和旋轉等
* 動作類的分類方法
** CCAction -- CCFiniteTimeAction -- CCActionInstant
** | |- CCActionInterval
** |- CCFollow
** |- CCSpeed
* 基礎瞬時動作使用方法 - CCActionInstant
** 動作 描述
** CCFlipX X軸鏡像翻轉
** CCFlipY Y軸鏡像翻轉
** CCHide 隱藏
** CCShow 顯示
* 基礎延時動作使用方法 - CCActionInterval
** 動作 描述
** CCMoveTo 移動至目標
** CCRotateTo 旋轉至指定的角度
** CCScaleTo 縮放至指定的倍數
** CCBlink 閃爍
* 總結
* 動作類的基本概念
** 動作類對象通常不會單獨存在
** 動作類對象需要作用在精靈,圖層等對象上才能發揮作用
** 動作類包含有很多種類型,例如位移,縮放和旋轉等
* 動作類的分類方法
** CCAction -- CCFiniteTimeAction -- CCActionInstant
** | |- CCActionInterval
** |- CCFollow
** |- CCSpeed
* 基礎瞬時動作使用方法 - CCActionInstant
** 動作 描述
** CCFlipX X軸鏡像翻轉
** CCFlipY Y軸鏡像翻轉
** CCHide 隱藏
** CCShow 顯示
* 基礎延時動作使用方法 - CCActionInterval
** 動作 描述
** CCMoveTo 移動至目標
** CCRotateTo 旋轉至指定的角度
** CCScaleTo 縮放至指定的倍數
** CCBlink 閃爍
* 總結
Subscribe to:
Posts (Atom)