Glaydur Posted September 15, 2014 Share Posted September 15, 2014 Was following codevinsky's flappy bird tutorial and this error showed up on the chrome dev tool. Here's the line that shows up when I press the error:Object.defineProperty(Phaser.Sprite.prototype, "exists", { get: function () { return !!this._cache[6]; }, set: function (value) { if (value) { // exists = true this._cache[6] = 1; if (this.body && this.body.type === Phaser.Physics.P2JS) { this.body.addToWorld(); } this.visible = true; } else { // exists = false this._cache[6] = 0; if (this.body && this.body.type === Phaser.Physics.P2JS) { this.body.removeFromWorld(); } this.visible = false; } }});Here's the relevant part of code in the scoreboard.js prefab and says it has an error in line I highlighted. But the above error shows up first in chrome's dev tool. I don't think I made any typo or:'use strict';var Scoreboard = function(game) { var gameover; Phaser.Group.call(this, game); gameover = this.create(this.game.width / 2, 100, 'gameover'); gameover.anchor.setTo(0.5, 0.5); this.scoreboard = this.create(this.game.width / 2, 200, 'scoreboard'); this.scoreboard.anchor.setTo(0.5, 0.5); this.scoreText = this.game.add.bitmapText(this.scoreboard.width, 180, 'flappyfont', '', 18); this.add(this.scoreText); this.bestScoreText = this.game.add.bitmapText(this.scoreboard.width, 230, 'flappyfont', '', 18); this.add(this.bextScoreText); this.startButton = this.game.add.button(this.game.width / 2, 300, 'startButton', this.startClick, this); this.startButton.anchor.setTo(0.5, 0.5); this.add(this.startButton); this.y = this.game.height; this.x = 0; };I would appreciate any help. Maybe this code isn't supported in Phaser 2.1.1 anymore? EDIT: So I just noticed that the colors weren't chancing for the highlighted part so I'll just post here what line the error pointed to: this._cache[6] = 1; Link to comment Share on other sites More sharing options...
rich Posted September 15, 2014 Share Posted September 15, 2014 May not be related, but this is wrong either way:gameover.achor.setTo(0.5, 0.5); Link to comment Share on other sites More sharing options...
Glaydur Posted September 15, 2014 Author Share Posted September 15, 2014 May not be related, but this is wrong either way:gameover.achor.setTo(0.5, 0.5);Oops yeah I copy pasted the old code, I have already fixed that typo. Still showing the same error Link to comment Share on other sites More sharing options...
Heppell08 Posted September 15, 2014 Share Posted September 15, 2014 This.scoreboard has a type error for width too. Link to comment Share on other sites More sharing options...
Glaydur Posted September 15, 2014 Author Share Posted September 15, 2014 This.scoreboard has a type error for width too.Oh yeah sorry, I should just copy paste the new code in but that might ruin the format. Anyway, just assume that all typos have been fixed hehe Link to comment Share on other sites More sharing options...
aurelien974 Posted February 24, 2015 Share Posted February 24, 2015 I have the same problem, did you solve it ? Link to comment Share on other sites More sharing options...
aurelien974 Posted February 24, 2015 Share Posted February 24, 2015 Ok, my bad... :I forgot to change this when I did a copy/paste : BEFORE : (while creating a group class)NP.Obstacle.prototype = Object.create(Phaser.Sprite.prototype);AFTER :NP.Obstacle.prototype = Object.create(Phaser.Group.prototype); Link to comment Share on other sites More sharing options...
Recommended Posts