我是第一次接触cocos2d-android。我正在尝试设置一些文本在两个精灵之间的碰撞后当前层,并在一段时间后,文本将消失。这怎么可能呢?请帮帮忙。
发布于 2012-12-26 14:21:44
很抱歉回复得太晚了
只需在使用this.schedule("update");在constructor中调用update()方法的update方法中调用此方法即可
对于addScore()方法,您可以使用自己的问题go here
public void addScore() {
CCLabel labelScore = CCLabel.makeLabel("" + dead, "DroidSans", 20);
labelScore.setColor(new ccColor3B(1,1,1));
labelScore.setPosition(CGPoint.ccp(50, 50));
addChild(labelScore, 11);
labelScore.setTag(11);
_labelScores.add(labelScore);
CCCallFuncN actionMoveDone1 = CCCallFuncN.action(this, "labelFinished");
CCSequence action = CCSequence.actions(actionMoveDone1);
labelScore.runAction(action);
}
public void labelFinished(Object sender) {
CCLabel label = (CCLabel) sender;
if(label.getTag()== 11)
_labelScores.remove(label);
this.removeChild(label, true);
}在你的update方法中
public void update()
{
// Here is your code
addScore();
}https://stackoverflow.com/questions/9140302
复制相似问题