Android: relative movement (logic question)

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Android: relative movement (logic question)

Post 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.
Attachments
move_relative.zgeproj
android touch test,.
(2.1 KiB) Downloaded 428 times
iterationGAMES.com
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post 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?
Attachments
RelativeMovement.zgeproj
touch test 2
(2.28 KiB) Downloaded 458 times
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post 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.
iterationGAMES.com
Post Reply