Search the Community

Showing results for tags 'on'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 3 results

  1. Hi, I hope I have titled this question correctly. I would like to know how to check that this.load.on has ' progress' or 'complete' or any other event that I can use if I need to ( or any other object in Phaser 3). Is there a way to check it? Thanks!
  2. Hi, I'm still pretty new to Phaser and I'm making a character select screen that shows all of the characters (only 3). Each one has a button that looks like a power on/off switch. When you click the button it should toggle the button to the correct frame ("on"), but if you click another character it should switch "off" the button of the previously chosen character and turn the currently chosen button to "on." The toggling was one issue, this was the best thing I could think of (it works, but it ends up being repetitive since there are 3 characters): //Button this.pickPink = game.add.button(game.world.centerX, game.world.centerY+105, "buttons", this.pinkStart, this); this.pickPink.anchor.set(0.5, 0.5); //Start with Pink pinkStart: function () { if(this.pickPink && character !== "pink"){ //set button frame to "ON" this.pickPink.frame = 1; character = "pink"; } else if(this.pickPink && character === "pink"){ //set button frame to "OFF" this.pickPink.frame = 0; character = undefined; } console.log(character); }, But now I need to figure out how I would detect that if another button gets picked, turn the previous one (or all others) to OFF. I don't want more than one of these toggled on at a time. Is there anyway of achieving this? Many thanks and much appreciated!!
  3. In the game that I am currently making using Phaser and P2 Physics I am looking to turn off the collisions between 3 objects when the game is paused or when the level has ended and the scoreboard shows so that unnecessary collisions are not being checked and dropping the frame rate (game is intended to run on mobile devices). I am using the following two functions at the moment TurnOffCollisions: function() { console.log("TurnOffCollisions") SavedBallVelX = Ball.body.velocity.x; SavedBallVelY = Ball.body.velocity.y; Ball.body.velocity.x = 0; Ball.body.velocity.y = 0; this.game.physics.p2.gravity.y = 0; FairwayHole.body.clearCollision(); Ball.body.clearCollision(); FairwayHole.body.clearShapes(); Ball.body.clearShapes(); Block.body.clearCollision(); Block.body.clearShapes(); },And to turn on the Collisions again when the game is unpaused or the next level starts: TurnOnCollisions: function() { console.log("TurnOnCollisions"); this.game.physics.p2.enable(FairwayHole); this.game.physics.p2.enable(Ball); this.game.physics.p2.enable(Block); FairwayHole.body.loadPolygon("Physics", "Level1-Hole"); FairwayHole.kinematic = true; Ball.body.loadPolygon("Physics", "Ball2"); Ball.body.velocity.x = SavedBallVelX; Ball.body.velocity.y = SavedBallVelY; Block.body.static = true; this.game.physics.p2.gravity.y = 1400; ballMaterial = this.game.physics.p2.createMaterial("ballMaterial", Ball.body); groundMaterial = this.game.physics.p2.createMaterial("groundMaterial", FairwayHole.body); this.game.physics.p2.setWorldMaterial(groundMaterial, true, true, true, true); contactMaterial = this.game.physics.p2.createContactMaterial(ballMaterial, groundMaterial); contactMaterial.friction = 0.5; contactMaterial.restitution = 0.5; }However when I do this it seems to work OK, until the Level Finishes and the Ball object and FairwayHole object are still touching, even though I think I have turned off the Physics I get the following error: Uncaught TypeError: Cannot read property 'collisionMask' of undefined54.c.runNarrowphasephaser.js:76867 54.c.internalStepphaser.js:76685 54.c.stepphaser.js:78255 c.Physics.P2.updatephaser.js:61785 c.Physics.updatephaser.js:26388 c.Game.updateLogicphaser.js:26327 c.Game.updatephaser.js:44881 c.RequestAnimationFrame.updateRAFphaser.js:44865 c.RequestAnimationFrame.start.window.requestAnimationFrame.forceSetTimeOut._onLoopIs there a better way of turning on and off collisions using P2 Physics? Or Am I doing something wrong with the way I am doing it that is causing the game to crash?