Jump to content

Search the Community

Showing results for tags 'isDown'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 5 results

  1. I have been looking for a solution for a while now! the idea is to move the zombies to the point i hold the mouse in and stop when i release the mouse, this is my movement code: //check mouse down if (game.input.mousePointer.isDown) { //move all zombies zombies.forEach(function(zombie) { game.physics.arcade.moveToPointer(zombie, 400); //if in box reset velocity if ( Phaser.Rectangle.contains( zombie.body, game.input.x, game.input.y ) ) { zombie.body.velocity.setTo(0, 0); } //end if }, this); //end forEach } else { zombies.forEach(function(zombie) { zombie.body.velocity.setTo(0, 0); }, this); //end forEach } //end else if (game.time.now > nextFire) { fire(); } basically what i want is to check for the same input in mobile devices, i have tried using: game.input.onDown.add(move , this); but it didn't work well for me because the zombies kept on going on that direction forever. please help:( this is the full code: http://github.com/msal4.github.io/increment/
  2. In my game I want my character to instantly move to predetermined points at the press of the left and right arrow keys. The player starts at x coordinate of 0. Here is my current code: var n = 0; cursors = game.input.keyboard.createCursorKeys(); var coordinates = [{x: 0}, {x: 100}, {x: 200}, {x: 300}, {x: 400}]; if (cursors.left.isDown && player.position.x != 0) { n -= 1; player.position.x = coordinates[n].x; } if (cursors.right.isDown && player.position.x != 400) { n += 1; player.position.x = coordinates[n].x; } So this basically works, but the problem is it runs it for however long I have the key pushed down, and I want it to only run once per key stroke. I read that onDown is what I'm looking for, but I'm not sure how to use that. Can someone help me out or suggest a better way?
  3. Hello I have a problem. I want my player when he is in front of a bottle and when he interract with it (up arrow key) the frame of the bottle change. The problem is I use an overlap between player and bottle I use : if (cursors.up.isDown) { bouteille.frame = bouteille.frame +1; } but when in game I press the up key it change all frame in one ms. How can I set a timer or something to say I pressed one time I need to release key and do it only after repressed Thanks
  4. I’m trying to give user an option to choose one from 4 buttons, but when multiple keys are pressed at once, it executes more functions than one. keyQ.onDown.add(upA, this); keyW.onDown.add(upB, this); keyE.onDown.add(upC, this); keyR.onDown.add(upD, this); keyT.onDown.add(dismiss, this); I tried to use isDown like this, but It isn't working outside update function if (this.keyQ.isDown) { upA(); } else if (this.keyW.isDown) { upB(); }
  5. Hi! I upgraded from version 2.0.5 phaser to 2.0.7. I have created some controls that do something when they are pressed. In version 2.0.5 I used IsDown but now I have an error that is undefined ... Has been removed IsDown? This is some of my code: theGame.cursors = { 'left': theGame.game.input.keyboard.addKey(65), //a 'right': theGame.game.input.keyboard.addKey(68), //d 'down': theGame.game.input.keyboard.addKey(83), //s 'up': theGame.game.input.keyboard.addKey(87), //w }; if (theGame.cursors.left.isDown) { ... } A greeting.
  • Create New...