coolsharp의 놀이터

cocos2d for android - CrashTest

2011. 10. 18. 18:38 : 개발
/**
* FileName : CrashTest.java
* Comment : 액션 매니저 데모
* @version : 1.0
* @author : coolsharp
* @date : 2011. 10. 18.
*/
public class CrashTest extends com.coolsharp.test.game.ActionManager.ActionManagerDemo {
    /**
     * Crash 테스트
     */
    public CrashTest() {
        super();

        // CCSprite 생성
        CCSprite grossini = CCSprite.sprite("grossini.png");
        // 위치 지정
        grossini.setPosition(CGPoint.ccp(200, 200));
        // 자식으로 추가
        addChild(grossini);

        // 1.5초 동안 360도 각도를 틀음
        grossini.runAction(CCRotateBy.action(1.5f, 360));
        // 1.5초의 딜레이, 1.5초의 페이드아웃, 1.5초의 페이드인, 1.5초의 페이드아웃, 1.5초의 페이드
        grossini.runAction(CCSequence.actions(CCDelayTime.action(1.5f), CCFadeOut.action(1.5f), CCFadeIn.action(1.5f), CCFadeOut.action(1.5f), CCFadeIn.action(1.5f)));

        // 1.5초 후 홀로 소멸됨
        // 소멸되면서 같은 이름의 함수 호출
        this.runAction(CCSequence.actions(CCDelayTime.action(1.4f), CCCallFunc.action(this, "removeFunc")));

    }

    /**
    * Comment : 자기 자신을 죽이고 다른 넘을 호출하는 함수
    * @version : 1.0
    * @tags :
    * @date : 2011. 10. 18.
    */
    public void removeFunc() {
        // 부모를 얻은 후 자기 자신을 소멸함
        this.getParent().removeChild(this, true);
        // 선조 클레스에서 선언된 다음 레이어 호출
        this.nextCallback(null);
    }

    /**
    * Comment : 윈래 기본 타이틀을 오버라이딩 함
    * @version : 1.0
    * @tags : @return
    * @date : 2011. 10. 18.
    * @see com.coolsharp.test.game.ActionManager.ActionManagerDemo#title()
    */
    @Override
    public String title() {
        return "Test 1. Should not crash";
    }

    /**
    * Comment : 서브 타이틀 오버라이딩
    * @version : 1.0
    * @tags : @return
    * @date : 2011. 10. 18.
    * @see com.coolsharp.test.game.ActionManager.ActionManagerDemo#subtitle()
    */
    @Override
    public String subtitle() {
        return "한글 테스트";
    }
}

Posted by coolsharp