我正在研究 cocos2d,我需要为 sprite 添加一个侦听器。我的代码在这里
public class GameOverScreen extends CCLayer implements KeyHandler {
public static CCScene scene(Difficulty difficulty, long totalscore) {
CCScene result = CCScene.node();
CCSprite redeem = CCSprite.sprite("redeem.png");// listener to this sprite
CGSize s = CCDirector.sharedDirector().winSize();
redeem.setScale(Block.SCALE*Main.SCALE);
redeem.setPosition(-1, -1);
redeem.setAnchorPoint(CGPoint.ccp(-0.7f, -1));
result.addChild(new GameOverScreen(NewHighscore, totalscore));
result.addChild(redeem);
return result;
}