Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

Detect tap only if button was not pressed

$
0
0
This has most probably been asked heaps of times, but I'm not quite sure what to search.. A link to a thread would do just as fine as an answer. So I have an iOS sorta game in development where you can tap to jump, but also can click on buttons to like pause, for example. When I click a button, it also jumps - and limiting the area which can be clicked on to jump isn't an ideal solution - so is there some way to check if a button was pressed on the tap - otherwise jump? EDIT - Right now, jump is done by this: void Update () { if ((Input.GetMouseButtonDown(0) || Input.GetKeyDown("space")) && grounded) { GetComponent().AddForce(new Vector3(0f, 250f, 0f)); grounded = false; } } void OnCollisionStay (Collision other) { if (other.gameObject.tag == "Block") { grounded = true; } } void OnCollisionExit (Collision other) { if (other.gameObject.tag == "Block") { grounded = false; } } (May have missed some syntax while I copied it)

Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>