Jump to content

Overlap bugging after restart the game.


Recommended Posts

Hello guys, I'm making a simple Phaser game and everything works fine on the first run, but after the game is finished and the player restart the game, a weird bug that seems to be caused by the star occur... I've tryed to understand what is happening here the whole day with no succes... =/ I've made a simple video to explain better...

And here is the code from what seems to cause the problem.

    //creating falling star
    createStar : function()
            this.star = this.game.add.sprite(this.rndd,this.game.world.top,'star');
        }else if(!this.star.alive)

    //overlap test
    testOverlap : function(spriteA, spriteB) 
        var boundsA = spriteA.getBounds();
        var boundsB = spriteB.getBounds();
        return Phaser.Rectangle.intersects(boundsA, boundsB);

    update : function()
        if ((this.testOverlap(this.baskball, this.star)&&(this.star.alive)))

I hope someone can help me or has a tip. Sorry for my bad english and thanks in advice!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...