Search the Community

Showing results for tags 'off'.



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. I was posting this thread at the wrong place (it was in Phaser 2). OK, I am having a very bad time with clickable objects. It works perfectly on desktop browser but when I run it on my Android mobile the hot spot is totally off. Please refer to the attached picture to have an idea what I am talking about. The blue square is the clickable object (it's a .png picture). Tapping the object won't fire the input event but if I tap around the position where I draw the marquee it will. In other words, the clickable area is off of the picture. I found this thread where the OP had a similar issue and mentioned that is could be related to the mobile devicePixelRatio when using Phaser.CANVAS but I couldn't establish a coherent relationship between the DPR and the displacement (otherwise it could be "compensated" with code). I really cannot see how to solve this. I am about to give up Phaser and try a different engine. Any idea?
  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?