cocos2d-android——时间调度

来源:未知 责任编辑:责任编辑 发表时间:2014-01-26 21:58 点击:

1、GameLayer

package com.njupt.schedule01;

import org.cocos2d.actions.interval.CCJumpTo;
import org.cocos2d.layers.CCLayer;
import org.cocos2d.nodes.CCSprite;
import org.cocos2d.types.CGPoint;

import android.view.MotionEvent;

public class GameLayer extends CCLayer{

	
	public GameLayer() {
		this.setIsTouchEnabled(true);
		
		//每个1秒钟调用一次fun方法...
		this.schedule("fun",1);
	}
	
	/**
	 * delta表示本次调用与上次调用的时间差
	 * @param delta
	 */
	public void fun(float delta){
		System.out.println("我爱章泽天...  "+delta);
	}

	@Override
	public boolean ccTouchesBegan(MotionEvent event) {
		this.unschedule("fun");//取消时间调度..
		
		return super.ccTouchesBegan(event);
	}
	
	
}



    发表评论
    请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
    用户名: 验证码:点击我更换图片
    最新评论 更多>>

    推荐热点

    • cocos2d-x学习笔记(19)--label 、label atlas
    • cocos2d-x学习笔记(23)--地图的使用3--CCTMXLayer
    • Cocos2d-x学习(一):HelloWorld
    • cocos2dx在xcode下开发,编译到android上(2)
    • cocos2d 设置屏幕默认方向
    • cocos2d-x学习笔记(22)--地图的使用2(TMX) --Z-Order、AnchorPoi
    • Cocos2d-x 2.0 之 Actions “三板斧” 之一
    • cocos2d-x学习笔记(18)--游戏打包(windows平台)
    • cocos2d-x学习笔记(16)--spritesheet(精灵表单)
    网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
    Copyright © 2008-2015 计算机技术学习交流网. 版权所有

    豫ICP备11007008号-1