vanni784 Posted November 29, 2018 Share Posted November 29, 2018 var config = { type: Phaser.AUTO, width: 800, height: 600, physics: { default: 'arcade', arcade: { gravity: { y: 400 }, debug: false, setBounds: true } }, // gravity: {y:400}, scene: { preload: preload, create: create, update: update, collideaa: collideaa } }; function create(){ ---some codes here-- } function update(time, delta) { if(gameoverID == false){ if(this.boy.y > this.cameras.main.height || this.boy.y <= 0) { // collide(); this.events.on(collideaa(), this); //collideaa(); //this.collideaa(); } } } function collideaa() { this.physics.pause(); } my function in update doesnt work. well actually it somehow works but after it is passed to the function but it says that the pause doesnt work. When i try other methods of using the function like the code below, it apparently works properly function create(){ this.physics.add.collider(this.boy, this.pipes, collideaa, null, this); } Link to comment Share on other sites More sharing options...
samme Posted November 29, 2018 Share Posted November 29, 2018 if (gameoverID == false) { if (this.boy.y > this.cameras.main.height || this.boy.y <= 0) { this.physics.pause(); } } Link to comment Share on other sites More sharing options...
vanni784 Posted November 30, 2018 Author Share Posted November 30, 2018 I know i can do that, but i wanna call a function to do that, do you have an idea how to properly call the function? Link to comment Share on other sites More sharing options...
samme Posted November 30, 2018 Share Posted November 30, 2018 { scene: { preload: preload, create: create, update: update, extend: { collideaa: collideaa } } } this.collideaa(); Link to comment Share on other sites More sharing options...
Recommended Posts