Search the Community

Showing results for tags 'swipe'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

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

Found 11 results

  1. Hello, I'm very new to Javascript (and coding). I just finished my first game, a clone of Pong. I have it controlled via the mouse movement, now I'd like to add code that will let the user swipe up or down on a touchscreen and have that relate the to controls for the mouse. Any Help would be appreciated. Thanks in advance. Here is what I have for my mouse controls. window.onload = function() { canvas = document.getElementById('gameCanvas'); canvasContext = canvas.getContext('2d'); var framesPerSecond = 30; setInterval(function() { moveEverything (); drawEverything(); }, 1000/framesPerSecond); canvas.addEventListener('mousedown', handleMouseClick); canvas.addEventListener('mousemove', function(evt) { var mousePos = calculateMousePos(evt); paddle1Y = mousePos.y - (PADDLE_HEIGHT/2); }); } code help.tiff
  2. The default setup for buttons in Phaser is that if you click on a button, then move the mouse (or finger on mobile) off the button, when you let go it still registers as a click/tap. Is there a way to have Phaser buttons perform like most buttons - where if you move the input off the button before you release, it does not activate the button?
  3. Swipe not working

    Hello, i try to create game for mobile devices, and i have a script which work on phaser, but not working on MightyEditor this.swipeMinDistance = 100; this.game.input.onDown.add(function(pointer) { swipeCoordX = pointer.clientX; swipeCoordY = pointer.clientY; }, this); this.game.input.onUp.add(function(pointer) { swipeCoordX2 = pointer.clientX; swipeCoordY2 = pointer.clientY; if(swipeCoordX2 < swipeCoordX - swipeMinDistance){ console.log("left"); }else if(swipeCoordX2 > swipeCoordX + swipeMinDistance){ console.log("right"); }else if(swipeCoordY2 < swipeCoordY - swipeMinDistance){ player.body.velocity.y = -600; }else if(swipeCoordY2 > swipeCoordY + swipeMinDistance){ console.log("down"); } }, this); How to fix, this? Thank you!
  4. Swipe effect (Slide Box) in Phaser

    Hi guys, This is my example: http://codepen.io/jdnichollsc/full/ZGoNKg/ What do you think? Regards, Nicholls
  5. My 2nd game is online. It's a realtime 60FPS HTML5 game with 3D camera running at 60FPS on mobile devices (S3+ / iPhone4s+ / Lumia520+). Give it a try and let me know what you think or may want to see improved. Play it online here: http://m.spielaffe.de/Spiele/Soccertastic/197683089129
  6. Windows Phone swipe problem

    Hi, I have problem with swipes on Windows Phone. In our game characters are moved with swipes. It works well on all devices except Windows Phone. On Windows Phone whole canvas is moved when you try to make a swipe. I googled and added "-ms-touch-action: none;" to body style in css and also to div element that holds canvas in index.html (<div id="content" style="overflow: hidden; -ms-touch-action: none;"></div>). Unfortunately, I do not have WP available to test on. The person that encountered problem says, that problem is still there. I would like to ask: did you encountered this? And if yes, what was your solution?
  7. Hi folks, I have a game built in Pixi, pulled into a website in an iFrame. The game takes up most of the screen except for a menu at top and a footer at bottom. The bottom of the game and the footer are off the bottom of the screen and I want the player to be able to scroll / swipe to see the bottom of the game and the footer of the site. It appears that since almost all of the visible screen is the canvas, the swipes are not picked up by the main site and so the site doesn't scroll. Any thoughts on how to get this to work? Thanks,
  8. Hi everyone, I'm following a Phaser tutorial by @bryanbibat , the Shoot'em up game. The function moveTopoiter is good when play the game by mouse cursor. However, it hides my view on mobile touch screen. So that I want to improve the controlling of player on mobile touch by swipe action. I tryng to replace these lines in the update function: if (this.input.activePointer.isDown && this.physics.arcade.distanceToPointer(this.player) > 15) { this.physics.arcade.moveToPointer(this.player, this.player.speed); }with these if (this.input.activePointer.isDown ){ this.player.body.velocity.x = (this.input.activePointer.position.x - this.input.activePointer.positionDown.x) * 2; this.player.body.velocity.y = (this.input.activePointer.position.y - this.input.activePointer.positionDown.y); } else { this.player.body.velocity.x = 0; this.player.body.velocity.y = 0; }It works but the control isn't good. It isn'e sensitivre and jitter. I've just read these post but it doesn't help. http://www.html5gamedevs.com/topic/3862-swipe-to-jump/ http://www.html5gamedevs.com/topic/5449-directional-swipe/ Could anybody give me an advice?
  9. Directional swipe

    Hello everyone, I'm fairly new to Phaser, and I'm just starting to figure things out. I made a simple prototype that uses "game.input.keyboard.createCursorKeys()" to listen and process the keyboard's cursor keys. Basically I have a sprite that moves up, down, left and right depending on input. Now I'm trying to achieve the same using touch events: when I swipe left, the sprite moves left; when I swipe up, the sprite moves up, etc.... but with no success. I've managed to detect swipe using a solution that user @imshag posted in this topic: http://www.html5gamedevs.com/topic/3862-swipe-to-jump/?hl=%2Bswipe+%2Bphaser#entry24473 It detects swipe, but doesn´t give me info on the direction of it. I could really use your help... How can I detect the direction of a swipe, and limit it to "up", "down", "left" and "right? Thanks in advance!
  10. Pixi.js swipe event

    Hi All, Is there any built-in method to register swipe(right,left) event for sprite in PIXI.js. There is no such method listed in PIXI.js documentation (http://www.goodboydigital.com/pixijs/docs/classes/Sprite.html) or am i missing something? if there is no built-in method to register swipe event, Can i use "Sprite.touchend" event and write some logic to find swipe left and swipe write event. I have tried this approach by using "mouseData.getLocalPosition(mySprite)" but could not figure out how to find swipe( left and right). I am a newbie in Javascript any code snippet will be really helpful. Thanks
  11. Swipe to Jump

    Hello. I am looking to add a swipe action, so that I can make the player jump. For navigation I have split the screen in two parts, if player clicks and holds on one right side the character will move right and vice versa. if (game.input.pointer1.isDown){ if (Math.floor(game.input.x/(game.width/2)) === LEFT) { // Move to the left player.body.velocity.x = 150; player.animations.play('right'); } if (Math.floor(game.input.x/(game.width/2)) === RIGHT) { // Move to the right player.body.velocity.x = -150; player.animations.play('left'); } }How can I record swiping up? Cheers Richard