- Home /
iOS Tap to move??
This might sound a little strange but I am making a simple game where there is a pig and you have to tap the screen to make it move directly forward. I have no idea whatsoever how to do this because I have only done coding for a little while, plus, I'm still in primary school. I really need a script for the tap to move!
Any code or help will be appreciated!
Answer by Em3rgency · Jul 02, 2013 at 04:19 PM
Well I recommend reading into programming then :) But for now, here a very detailed iOS beginners guide for unity: http://www.raywenderlich.com/25205/beginning-unity-3d-for-ios-part-13
At the end, it shows you how to make a cube move by touch, so you can use this :)
Answer by ebogguess · Jul 02, 2013 at 04:28 PM
You need an Update method that checks for touches, then moves the object forward. Something like
void Update() {
if (Input.touches > 0)
{
transform.position += new Vector3(1, 0, 0);
}
}