码迷,mamicode.com
首页 > 移动开发 > 详细

cocos2d_android 瞬间动作

时间:2014-07-29 16:44:11      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:android   des   blog   http   java   os   io   2014   

该文章所写的瞬间动作主要有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);

	}
}




cocos2d_android 瞬间动作,布布扣,bubuko.com

cocos2d_android 瞬间动作

标签:android   des   blog   http   java   os   io   2014   

原文地址:http://www.cnblogs.com/hrhguanli/p/3875309.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!