- Home /
move and fire mobile
So, I am almost finished with my first game. If I want to make it just playable on a PC then it's done but I'd like to port it to mobile and make it available on the android store. The problem is that I can't get the movement and fire to work. I know it needs to recognize the difference between a tap and holding down. the question is how...? Below is my movement and fire portion of the script. Any assistance would be greatly appreciated.
void Update () {
//below will pull information for the inputs
float xAxis = Input.GetAxis ("Horizontal");
float yAxis = Input.GetAxis ("Vertical");
//Change transpos based on axes
Vector3 pos = transform.position;
pos.x += xAxis * speed * Time.deltaTime;
pos.y += yAxis * speed * Time.deltaTime;
transform.position = pos;
bounds.center = transform.position;
Vector3 off = Utils.ScreenBoundsCheck (bounds, BoundsTest.onScreen);
if (off != Vector3.zero) {
pos -= off;
transform.position = pos;
}
//Ship rotation
transform.rotation = Quaternion.Euler (yAxis * pitchMult, xAxis * rollMult, 0);
//to fire
if (Input.GetAxis("Jump") == 1 && fireDelegate != null) {
fireDelegate();
}
}
Comment
Answer by TheSorm · Apr 24, 2016 at 02:38 AM
You shut check out "Unity Cross Platform input" just google and you will finde good tutorials
Your answer
![](https://koobas.hobune.stream/wayback/20220612075443im_/https://answers.unity.com/themes/thub/images/avi.jpg)