Sam987X

Collision error with arcade physics

Recommended Posts

Hi i'm quite new to phaser but ive been making this game for a school project where you control a helicopter and when the helicopter body collides with the water refill building it refills the water but if i go up against the side of the building and change direction it flips my helicopter so that it flys the other direction which then makes the helicopter overlapping the water refill building and my game crashes and i get this error 

Game.js:342 Uncaught ReferenceError: refill is not defined
    at Function.<anonymous> (Game.js:342)
    at Phaser.Physics.Arcade.collideSpriteVsSprite (phaser.js:80431)
    at Phaser.Physics.Arcade.collideSpriteVsGroup (phaser.js:80520)
    at Phaser.Physics.Arcade.collideHandler (phaser.js:80369)
    at Phaser.Physics.Arcade.overlap (phaser.js:80121)
    at Object.update (Game.js:341)
    at Phaser.StateManager.update (phaser.js:30658)
    at Phaser.Game.updateLogic (phaser.js:38763)
    at Phaser.Game.update (phaser.js:38707)
    at Phaser.RequestAnimationFrame.updateRAF (phaser.js:61260)
	function Refill()
    {
	water = 3
	}
                
game.physics.arcade.overlap(player, WaterBuildings, function (overlappingPlayer, overlappingWaterBuildings) {
                refill()
                    });

any help would be much appreciated

Capture2.PNG

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.