Phempt Posted November 22, 2014 Share Posted November 22, 2014 Hello guys, I've a problem with "touchstart" event on android devices. The touch event is detected 300ms later, and this cause a lot of problems. I tried to solve using a meta tag:<meta name="viewport" content="width=device-width, user-scalable=no">but nothing, so I tried to download and configure a library ( https://github.com/ftlabs/fastclick ): <script type="text/javascript" src="src/other/jquery-2.1.1.min.js"></script><script type="text/javascript" src="src/other/fastclick.js"></script><script type="text/javascript"> $(document).ready(function(){ $(function() { FastClick.attach(document.body); }); });</script>but nothing, anyone can help me to solve this issue? Quote Link to comment Share on other sites More sharing options...
enpu Posted November 22, 2014 Share Posted November 22, 2014 What device? What Android version? Using wrapper? Quote Link to comment Share on other sites More sharing options...
Phempt Posted November 22, 2014 Author Share Posted November 22, 2014 It's wrapped with CrossWalk, tested with:Galaxy Note 8", Android 4.4.2Acer liquid Z3 Duo, Android 4.2Moto G 2nd Generation (2014), Android 4.4.4 Quote Link to comment Share on other sites More sharing options...
enpu Posted November 22, 2014 Share Posted November 22, 2014 Does it occur when using just Chrome browser? Quote Link to comment Share on other sites More sharing options...
Phempt Posted November 22, 2014 Author Share Posted November 22, 2014 I'll try to set up a web server in localhost for bubbles party, unfortunately it is the only one game developed directly through XCode and Phonegap (I'm following your suggestion for our next games ) Quote Link to comment Share on other sites More sharing options...
Phempt Posted November 22, 2014 Author Share Posted November 22, 2014 @enpu also through Chrome the same problem. Quote Link to comment Share on other sites More sharing options...
enpu Posted November 22, 2014 Share Posted November 22, 2014 That's weird, can you show your "touchstart" code? Quote Link to comment Share on other sites More sharing options...
Phempt Posted November 22, 2014 Author Share Posted November 22, 2014 yeah, this is my function (I used this on iOS with perfect result):this.sprite.touchstart = this.sprite.click = function() { if (game.system.paused != true) { this.remove(); if (killHundred < 100) { killHundred = killHundred + 1; game.storage.set("killHundred", killHundred) } expNum = Math.floor(Math.random() * 2) + 1; if (audioState == 0) { if (expNum == 1) { game.audio.playSound("laugh") } else { if (expNum == 2) { game.audio.playSound("laugh1") } } } score = score - 10; if (score < 0) { score = 0 } scoreText.setText(score.toString()); scoreText.updateTransform(); scoreText.position.x = 20; scoreText.position.y = 20; this.spriteAnimation = new game.Animation("objects/bubbles/obj-exp-evil_01.png", "objects/bubbles/obj-exp-evil_02.png", "objects/bubbles/obj-exp-evil_03.png", "objects/bubbles/obj-exp-evil_04.png", "objects/bubbles/obj-exp-evil_05.png", "objects/bubbles/obj-exp-evil_06.png"); this.spriteAnimation.position.set(this.position.x, this.position.y); this.spriteAnimation.anchor.set(0.5, 0.5); this.spriteAnimation.scale.set(0.8, 0.8); this.spriteAnimation.animationSpeed = 0.1; this.spriteAnimation.loop = false; this.spriteAnimation.play(); game.scene.stage.addChild(this.spriteAnimation); } }And this is the screenshot (61fps, really nice): http://oi61.tinypic.com/2i7plrc.jpg Quote Link to comment Share on other sites More sharing options...
Phempt Posted November 22, 2014 Author Share Posted November 22, 2014 I also tried to download the latest panda's framework, but the problem persists. Quote Link to comment Share on other sites More sharing options...
Phempt Posted November 22, 2014 Author Share Posted November 22, 2014 Update:At the moment I tried with no results adding a preventDefault() function here:a.touchstart = a.click = function(event){[...my code...]event.preventDefault();}Than I tried with:<script type="text/javascript"> window.addEventListener( "load", function() { FastClick.attach( document.body ); }, false );</script>instead of jQuery way without any results... @enpu if you need the APK I can send it to you. Let me know Quote Link to comment Share on other sites More sharing options...
Phempt Posted November 22, 2014 Author Share Posted November 22, 2014 I made other tests on other devices. Working Devices:- MotoG 2nd Generation 2014, Android 4.4.4- Galaxy Note 10.1- HTC Sensation, Android 4.0.3 (Thank you Oddskill) Not Working Devices (Latency on Touchevents):- Galaxy Note 8", Android 4.4.2- Acer liquid Z3 Duo, Android 4.2- Samsung Galaxy S3 (gt-I9300) Android 4.3.2 If you want to try the alpha version, download this APK. It's not optimized, because I'm trying to solve the latency issue before convert the sound and change the sprite. (Please if you write a feedback, add your device specifications) Quote Link to comment Share on other sites More sharing options...
Phempt Posted November 23, 2014 Author Share Posted November 23, 2014 I found this : https://github.com/filamentgroup/tappy/ but I think it's not possitble to integrate with Panda, am I wrong? Quote Link to comment Share on other sites More sharing options...
enpu Posted November 25, 2014 Share Posted November 25, 2014 Can you test just clean installation of Panda with one interactive sprite, to see if there is something wrong with your game code? Quote Link to comment Share on other sites More sharing options...
Phempt Posted November 25, 2014 Author Share Posted November 25, 2014 Tried, there is the latency, about ~300ms. Quote Link to comment Share on other sites More sharing options...
enpu Posted November 25, 2014 Share Posted November 25, 2014 And you sure you used touchstart function, not tap function? Quote Link to comment Share on other sites More sharing options...
Phempt Posted November 25, 2014 Author Share Posted November 25, 2014 yes, touchstart. Tomorrow I'll be back at home, I'll send you the small example used. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.