建立一个英雄

建立一个英雄,应当设置大小如下:

this.setContentSize(CGSize.make(85, 90)); 
    CCTouchDispatcher.sharedDispatcher().addTargetedDelegate(this, 1, true);
    //this.setIsTouchEnabled(true);
   
    // mao body
        mao=CCSprite.sprite("catBody1.png");
    CCAnimation animation = CCAnimation.animation("mao");
   animation.addFrame("catBody1.png");
   animation.addFrame("catBody2-4.png");
   animation.addFrame("catBody3.png");
   animation.addFrame("catBody2-4.png");
CCAnimate action = CCAnimate.action(3, animation, false);
CCAnimate action_back = action.reverse();
mao.runAction(CCRepeatForever.action(CCSequence.actions(action, action_back)));
addChild(mao,1);
//mao head
lefthand=CCSprite.sprite("catHand1.png");
        lefthand.setAnchorPoint(CGPoint.ccp(1,(float) 0.5));
        lefthand.setPosition(-18, -20);
        addChild(lefthand,2);
        righthand=CCSprite.sprite("catHand2.png");
        righthand.setAnchorPoint(CGPoint.ccp(0,(float) 0.5));
        righthand.setPosition(18, -20);
        addChild(righthand,3);
        //mao tail
        tail = CCSprite.sprite("catTail.png");
        tail.setAnchorPoint(CGPoint.ccp((float) 0.5,1));
        tail.setPosition(CGPoint.ccp(-5,-29));
        tail.setScale((float) 0.5);
        tail.setRotation(20);
        tail.runAction(CCRepeatForever.action(
        CCSequence.actions(CCRotateBy.action((float) 0.5,-40),CCRotateBy.action((float) 0.5,40))));
        addChild(tail,3);
        offset = CGPoint.ccp(0,0);
        iscontrol = false;


这样的坐标是对contentsize来设置的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值