Page 1 of 1
Android: relative movement (logic question)
Posted: Sun Oct 28, 2012 1:39 pm
by jph_wacheski
Ok, so I have worked out a system for relative movement for the player. When one touches the screen or releases from a multi-touch the single finger position is recorded,. and the player is moved relatively to any movement after that. This works how I like,. however if you quickly rock two fingers back and forth (touch un-touch) you can make the player obj jump positions,. this is an unwanted behavior that I can not find a way to eliminate. Any help with my apparently flawed logic much appreciated,. I have banged my head against this for some time now, to no avail. thanks.
Posted: Thu Nov 22, 2012 12:25 pm
by Rado1
Hi Jph, I started to create own code from the scratch because I thought I can create something simpler, but when I finished and look back at your code
... hmm...I wrote almost the same thing
Anyway, I have a suspicion that the problem with rocking of two fingers is that touchGetCount() does not return 0 between two touches if you're doing it very quickly; just jumps from one position to another. Therefore, I tried to restrict delta distance of a new position from the previous one. If it is too long (I used a stupid constant for any direction), model is not moved. Of course this disallows quick movements of finger, but how else to recognize fast finger move from flickering?
Posted: Sat Nov 24, 2012 12:34 am
by jph_wacheski
Thanks Rado, I will check this out. I have the first level of a game (BlackBulletHell II) mostly done, and if this helps fix that twitchy issue I will likely get it done sooner,. cheers.