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+lua[2]](/uploads/allimg/131030/110J64609-0-lp.jpg)








