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) {

any help would be much appreciated


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.