cocos2d_android 瞬间动作

该文章所写的瞬间动作主要有CCFlipX,CCFlipY,CCHide,CCShow


当中CCFlipX是以Y轴为中心旋转,CCFlipY是以X轴为中心旋转,CCHide将精灵对象隐藏,CCShow将精灵对象展如今屏幕上


activity中的代码还是件activity内容,本文仅仅附上四个瞬间动作的代码


package com.sdufe.android;

import org.cocos2d.actions.instant.CCFlipX;
import org.cocos2d.layers.CCLayer;
import org.cocos2d.nodes.CCSprite;
import org.cocos2d.types.CGPoint;

public class GameLayer extends CCLayer {

	private CCSprite sprite;

	public GameLayer() {

		sprite = CCSprite.sprite("ic_launcher.png");

		CGPoint pos = CGPoint.ccp(100, 100);
		sprite.setPosition(pos);

		addChild(sprite);

		CCFlipX flipX = CCFlipX.action(true);
		sprite.runAction(flipX);

	}
}
package com.sdufe.android;

import org.cocos2d.actions.instant.CCFlipY;
import org.cocos2d.layers.CCLayer;
import org.cocos2d.nodes.CCSprite;
import org.cocos2d.types.CGPoint;

public class GameLayer extends CCLayer {

	private CCSprite sprite;

	public GameLayer() {

		sprite = CCSprite.sprite("ic_launcher.png");

		CGPoint pos = CGPoint.ccp(100, 100);
		sprite.setPosition(pos);

		addChild(sprite);


		CCFlipY flipY = CCFlipY.action(true);
		sprite.runAction(flipY);


	}
}

package com.sdufe.android;

import org.cocos2d.actions.instant.CCHide;
import org.cocos2d.layers.CCLayer;
import org.cocos2d.nodes.CCSprite;
import org.cocos2d.types.CGPoint;

public class GameLayer extends CCLayer {

	private CCSprite sprite;

	public GameLayer() {

		sprite = CCSprite.sprite("ic_launcher.png");

		CGPoint pos = CGPoint.ccp(100, 100);
		sprite.setPosition(pos);

		addChild(sprite);

		// CCFlipX flipX = CCFlipX.action(true);
		// sprite.runAction(flipX);
		//
		// CCFlipY flipY = CCFlipY.action(true);
		// sprite.runAction(flipY);

		CCHide hide = CCHide.action();
		sprite.runAction(hide);


	}
}

package com.sdufe.android;

import org.cocos2d.actions.instant.CCShow;
import org.cocos2d.layers.CCLayer;
import org.cocos2d.nodes.CCSprite;
import org.cocos2d.types.CGPoint;

public class GameLayer extends CCLayer {

	private CCSprite sprite;

	public GameLayer() {

		sprite = CCSprite.sprite("ic_launcher.png");

		CGPoint pos = CGPoint.ccp(100, 100);
		sprite.setPosition(pos);

		addChild(sprite);

		// CCFlipX flipX = CCFlipX.action(true);
		// sprite.runAction(flipX);
		//
		// CCFlipY flipY = CCFlipY.action(true);
		// sprite.runAction(flipY);

		// CCHide hide = CCHide.action();
		// sprite.runAction(hide);

		CCShow show = CCShow.action();
		sprite.runAction(show);

	}
}


 
  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值