Question by
Fortie · Jan 23, 2016 at 07:10 PM ·
androidtouchtouchscreen
Android Touch Issue
Hello everybody! I`ve stuck with my game.
When i was developing my game i was testing it via my PC, but once i decided to try it on my Mobile Phone (it`s on Android 5.1) and i had a huge problem: my jump system was working incorrect. I want to describe you my system: i gave to my character ability to jump few times (i`ve set statement of this ability to 0.5, that gave him possibility to jump at least 4 times), but when i`ve started game on my phone i noticed that character is able to jump only 1 time and less often for 2 times. It`s very necessary for me, help please!
myRigidBody.velocity = new Vector2 (moveSpeed, myRigidBody.velocity.y); if (Input.GetTouch (0).phase == TouchPhase.Began) { if (grounded) { myRigidBody.velocity = new Vector2 (myRigidBody.velocity.x, jumpForce); } for (var i = 0; i < Input.touchCount; ++i) { if (Input.GetTouch (0).phase == TouchPhase.Began) { if (jumpTimeCounter > 0) { myRigidBody.velocity = new Vector2 (myRigidBody.velocity.x, jumpForce); jumpTimeCounter -= Time.deltaTime; } } if (Input.GetTouch (0).phase == TouchPhase.Began) { jumpTimeCounter = 0; } if (grounded) { jumpTimeCounter = jumpTime; } } }
Thanks a lot!
Comment