cc.sys.localStorage.setItem("ScoreDisplay",this.score.toString());
Gameing場景
node
gainScore:function (pos) { window.score += 1; this.scoreDisplay.string = window.score.toString(); //cc.sys.localStorage.setItem("ScoreDisplay",this.scoreDisplay.string); var fx = cc.instantiate(this.scoreFXPrefab).getComponent('ScoreFX'); this.node.addChild(fx.node); fx.node.setPosition(pos); fx.play(); cc.audioEngine.playEffect(this.scoreAudio,false); },
disScore: function () { //this.score = cc.sys.localStorage.getItem("ScoreDisplay"); this.score = window.score; this.Scores.string = "Score: " + this.score.toString();//顯示 },
var rec = cc.rectEqualToRect(this.node.getBoundingBoxToWorld(),pos) ;
var rec = cc.rectContainsPoint(this.node.getBoundingBoxToWorld(),pos) ;
setCp:function(pos){ var rec = cc.rectContainsPoint(this.node.getBoundingBoxToWorld(),pos) ; if(rec){ if(this.isOpen){ cc.audioEngine.pauseMusic(); cc.log("暫停正在播放音樂"); this.isOpen = false; } else { cc.audioEngine.resumeMusic (); cc.log("恢復背景音樂"); this.isOpen = true; } } },