Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'reset' of null Level.js:86 #2

Open
butteredtoast opened this issue Nov 8, 2014 · 2 comments
Open

Cannot read property 'reset' of null Level.js:86 #2

butteredtoast opened this issue Nov 8, 2014 · 2 comments
Assignees
Labels

Comments

@butteredtoast
Copy link
Owner

createNewLedge: function () {
        // Get the first dead pipe of the group
        var ledge = this.platforms.getFirstDead();

        var x = 750;
        var y = this.rand(250, 450);

        ledge.reset(x, y);  <--- // Error here

        // Make the length of the ledge be variable
        ledge.scale.setTo(0.5, this.rand(0.5, 1));
Uncaught TypeError: Cannot read property 'reset' of null Level.js:86

I think it's because the first platform startLedge never gets destroyed. So getFirstDead() never gets called. Once the specified number of platforms has been blitted, reset gets a null object, hence the error.

@butteredtoast butteredtoast self-assigned this Nov 8, 2014
@codenamesubho
Copy link
Collaborator

Maybe something like this can fix it.

ledge.checkWorldBounds = true;
ledge.outOfBoundsKill = true;

@butteredtoast
Copy link
Owner Author

That code is already in place in lines 98 and 99 of the Level.js module here
https://github.com/butteredtoast/Phase/blob/master/js/Level.js but...

On 8 November 2014 13:58, Subhendu Ghosh notifications@github.com wrote:

Maybe something like this can fix it.

ledge.checkWorldBounds = true;
ledge.outOfBoundsKill = true;


Reply to this email directly or view it on GitHub
#2 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants