Quantcast
Channel: Questions in topic: "up"
Viewing all articles
Browse latest Browse all 104

How do i make up and down button script for Mobile in Unity 5.3.2

$
0
0
Im making a 2d game that only moves up and down for Android but cant seem to find a script for simple up and down button movement. i watched tons if tutorials on how to move with mobile but none explain how to move Up and Down. i have a script that works perfectly fine on my computer but i want to convert the script for touch screen movement for my android device. using System.Collections; public class PlayerMovement : MonoBehaviour { public enum type {platformer, topdown}; public type moveType; public float moveSpeed, jumpHight; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (moveType == type.topdown && Input.GetAxisRaw("Vertical") > 0) { transform.Translate (Vector2.up * Time.deltaTime * moveSpeed); } else if (moveType == type.topdown && Input.GetAxisRaw("Vertical") < 0) { transform.Translate (Vector2.down * Time.deltaTime * moveSpeed); } } }

Viewing all articles
Browse latest Browse all 104

Trending Articles



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