Search the Community

Showing results for tags 'inputhandler'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • 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


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 2 results

  1. I am learning Phaser CE API and i cannot understand the param `alphaThreshold` in the method enableDrag. Anybody can tell me how to use it correctly?
  2. I'm working on an on-screen touch controller similar to the one in Phaser examples page: My game (this is for a new Phaser tutorial!): I'm experiencing the following issue on a Nexus 5 with Android L (Chrome, Firefox and the Intel XDK App Preview app), when I do this sequence without taking the finger off the phone: right arrow button -> left arrow button -> right arrow button -> left arrow button --> lift the finger After I lift the finger, the character keeps on moving to the left, because the left arrow button never triggers a "out" event. Console output on the phone when doing this "right left right left" sequence without lifting the finger: right input down main.js:200 right input out main.js:195 left input out main.js:174 --> we see an "out" event for the left button, but no "over" event was ever triggered for this element right input over main.js:190 right input out main.js:195 left input over main.js:169 right input up main.js:205 --> no "up" or "out" event is triggered for the left button even after lifting the finger, that's why the character will keep on moving to the left after lifting the finger. (note: if you do the sequence in the opposite order, the same thing happens just to the other side) Version of Phaser 2.2.2 Code: //this game will have only 1 statevar GameState = { //initiate game settings init: function() { //adapt to screen size, fit all the game this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; this.scale.pageAlignHorizontally = true; this.scale.pageAlignVertically = true; //init physics system; //define some constants this.RUNNING_SPEED = 220; this.JUMPING_SPEED = 550; }, //load the game assets before the game starts preload: function() { this.load.image('ground', 'assets/images/ground.png'); this.load.image('platform', 'assets/images/platform.png'); this.load.image('player', 'assets/images/player.png'); this.load.image('fire', 'assets/images/fire.png'); this.load.image('goal', 'assets/images/goal.png'); this.load.image('arrowButton', 'assets/images/arrowButton.png'); this.load.image('actionButton', 'assets/images/actionButton.png'); }, //executed after everything is loaded create: function() { //size of the game world, 0, 360, 700); //floor this.ground =, 638, 'ground'); //enable physics properties (the floor wont move); this.ground.body.immovable = true; //level data. location of elements var levelData = { platformData: [ {x: 0, y: 430}, {x: 45, y: 560}, {x: 90, y: 290}, {x: 0, y: 140} ], fireData: [ {x: 200, y: 538}, {x: 60, y: 408}, {x: 190, y: 408}, {x: 180, y: 268}, {x: 200, y: 118} ] }; //group to keep all the hard platforms this.platforms =; //enable physics properties this.platforms.enableBody = true; //create each platform var self = this; var platform; levelData.platformData.forEach(function(element){ platform = self.platforms.create(element.x, element.y, 'platform'); //we don't need to enable body on each element, as we enabled body for the entire group, so body will be present here platform.body.immovable = true; }); //group for fire this.fires =; this.fires.enableBody = true; //create fire var fire; levelData.fireData.forEach(function(element){ fire = self.fires.create(element.x, element.y, 'fire'); }); //create goal this.goal =, 90, 'goal');; //create player this.player =, 545, 'player');; this.player.body.gravity.y = 1000; //object for custom parameters we might want to add this.player.customParams = new Object(); //don't leave the world boundaries this.player.body.collideWorldBounds = true; //the camera will follow the player in the world; //arrow keys this.cursors =; //add touch control this.createButtons(); }, update: function() { //the player collides with the ground and platforms, this.ground);, this.platforms);, this.fires, this.burn, null, this);, this.goal,, null, this); //platformer controllers this.player.body.velocity.x = 0; //get the active input id var activePointer =; //moving to the left with the keys or touch if(this.cursors.left.isDown || this.player.customParams.isMovingLeft) { this.player.body.velocity.x = -this.RUNNING_SPEED; } //moving to the right with the keys or touch else if(this.cursors.right.isDown || this.player.customParams.isMovingRight) { this.player.body.velocity.x = this.RUNNING_SPEED; } //jumping with the up arrow or action button if((this.cursors.up.isDown || this.player.customParams.canJump) && this.player.body.touching.down) { this.player.body.velocity.y = -this.JUMPING_SPEED; //if action button is kept pressed it wont jump more times this.player.customParams.canJump = false; } }, //burn player burn: function(player, fire) { console.log('auch!'); game.state.start('GameState'); }, //win the game win: function() { alert('you win!'); game.state.start('GameState'); }, render: function() {, 0, 100); }, //create touch pad and enable input createButtons: function() { this.leftArrow =, 535, 'arrowButton'); this.rightArrow =, 535, 'arrowButton'); this.actionButton =, 535, 'actionButton'); //fix to camera this.leftArrow.fixedToCamera = true; this.rightArrow.fixedToCamera = true; this.actionButton.fixedToCamera = true; //left arrow button{ this.player.customParams.isMovingLeft = true; console.log('left input over'); }, this);{ this.player.customParams.isMovingLeft = false; console.log('left input out'); }, this);{ this.player.customParams.isMovingLeft = true; console.log('left input down'); }, this);{ this.player.customParams.isMovingLeft = false; console.log('left input up'); }, this); //right arrow button{ this.player.customParams.isMovingRight = true; console.log('right input over'); }, this);{ this.player.customParams.isMovingRight = false; console.log('right input out'); }, this);{ this.player.customParams.isMovingRight = true; console.log('right input down'); }, this);{ this.player.customParams.isMovingRight = false; console.log('right input up'); }, this); //action button{ this.player.customParams.canJump = true; }, this);{ this.player.customParams.canJump = false; }, this); }};//initiate the Phaser frameworkvar game = new Phaser.Game(360, 592, Phaser.AUTO);game.state.add('GameState', GameState);game.state.start('GameState');