coolsharp의 놀이터

'remove'에 해당되는 글 1건

  1. 2011.10.18 cocos2d for android - Remove 2

cocos2d for android - Remove

2011. 10. 18. 18:42 : 개발
/**
* FileName : RemoveTest.java
* Comment : Move 콜백 객체 배우자
* @version : 1.0
* @author : coolsharp
* @date : 2011. 10. 18.
*/
public class RemoveTest extends com.coolsharp.test.game.ActionManager.ActionManagerDemo {
    public RemoveTest() {
        super();

        // 이동 객체 생성
        CCMoveBy move = CCMoveBy.action(5, CGPoint.ccp(200, 0));

        // 콜백 객체 생성
        CCCallFunc callback = CCCallFunc.action(this, "stopAction");

        // 시퀀스 액션 등록(이동 객체를 콜백으로 등록)
        CCSequence sequence = CCSequence.actions(move, callback);
        // 시퀀스 객체를 나중에 찾아 써야 하므로 이름표 지정
        sequence.setTag(com.coolsharp.test.coolsharp_cocos2d_test_Activity.kTagSequence);

        CCSprite child = CCSprite.sprite("grossini.png");
        child.setPosition(CGPoint.ccp(200, 200));
        this.addChild(child, 1, com.coolsharp.test.coolsharp_cocos2d_test_Activity.kTagGrossini);

        // 시퀀스 액션 시작
        child.runAction(sequence);
    }

    public void stopAction() {
        Log.i("coolsharp", "SA");
//        CCNode sprite = getChildByTag(com.coolsharp.test.coolsharp_cocos2d_test_Activity.kTagGrossini);
//        sprite.stopAction(com.coolsharp.test.coolsharp_cocos2d_test_Activity.kTagSequence);
    }

    public String title() {
        return "Remove Test";
    }

    public String subtitle() {
        return "Should not crash. Testing issue #841";
    }

Posted by coolsharp