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

is coding for mobile touch scripts same for android as for ios apple?

$
0
0
is coding for mobile touch scripts same for android as for ios apple? so will this code work in ios apple iphones also or just android? using UnityEngine; using System.Collections; public class Toucht : MonoBehaviour { public float upForce; public float downForce; public float forwardSpeed; public bool isDead = false; Animator anim; bool flap = false; void Start() { anim = GetComponent (); GetComponent().velocity = new Vector2 (forwardSpeed, 0); } void Update() { if (isDead) return; Touch myTouch = Input.GetTouch(0); Touch[] myTouches = Input.touches; for(int i = 0; i < Input.touchCount; i++) flap = true; } void FixedUpdate() { if (flap) { flap = false; anim.SetTrigger ("Flap"); GetComponent ().velocity = new Vector2 (GetComponent ().velocity.x, 0); GetComponent ().AddForce (new Vector2 (0, upForce)); } if (Input.GetKeyDown("t")) { GetComponent().velocity = new Vector2(GetComponent().velocity.x, 0); GetComponent ().AddForce (new Vector2 (-0, downForce)); } } int hit = 0; void OnCollisionEnter2D(Collision2D other) { if(other.gameObject.tag == "Wall") { hit++; if(hit >= 25) Destroy(gameObject); } if(other.gameObject.tag == "Wall") { GetComponent().Play(); } } }

Viewing all articles
Browse latest Browse all 4709

Latest Images

Trending Articles



Latest Images

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