Jump to content

New to Phaser. Overlap method breaking my game.


mrphantastic
 Share

Recommended Posts

I'm building out some basic games to get me a feel of Phaser. When calling the method game.physics.arcade.overlap(), it breaks my game. My game just turns into a black screen. Same thing happens if I do game.physics.arcade.collide().

This makes me assume that the reasoning is game.physics.arcade.

What could be the problem?

Link to comment
Share on other sites

Just now, mrphantastic said:

Where can I check this?

Im using WAMP server and putting my JavaScript and HTML files in the www folder of the server.

Open your Game in the Browser and Press "F12.

Then switch to Console and you should see a error.

Link to comment
Share on other sites

2 hours ago, ITpaolo said:

Open your Game in the Browser and Press "F12.

Then switch to Console and you should see a error.

I get

Uncaught ReferenceError: collisionHandler is not defined

 

But I defined collisionHandler in a later function

 

function collisionHandler(bullet,enemy){
    bullet.kill();
    enemies.kill();
}

Link to comment
Share on other sites

1 hour ago, mrphantastic said:

Actually that is the wrong error. I get this error

Unable to get property 'physicsType' of undefined or null reference / phaser.js (85278,9)

You dont have a Physic for the bullet or the enemie.

 

e.g : 

enemies = this.game.add.group();
enemies.enableBody = true;
enemies.physicsBodyType = Phaser.Physics.ARCADE;

Try this, if it isn't working, write here. :P

(I'm new too to Phaser, so dont judge me :D)

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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