Jump to content

Collision error with arcade physics


Sam987X
 Share

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

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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