I've been away from /agdg/ for some time and I figured this would probably be the right place to ask for help of this sort of magnitude. I can not for the life of me understand scripting for cellphone controls. I was wondering if someone could change my script to work with the accelerometer to take over what would be WASD and tapping the screen for what would be the SPACEBAR. Thank you for those of you who lend a hand to my conundrum.
(picture obviously and entirely unrelated unless you count the tiger as my brain awash in a sea of algae script)
#pragma strict
var rotationSpeed = 100;
var jumpHeight = 8;
private var isFalling = false;
function Update ()
{
//Handle ball rotation.
var moveHorizontal : float = Input.GetAxis("Horizontal");
var moveVertical : float = Input.GetAxis("Vertical");
var movement : Vector3 = new Vector3(moveHorizontal, 0.0, moveVertical);
GetComponent.<Rigidbody>().AddForce(movement * rotationSpeed * Time.deltaTime);
if (Input.GetKeyDown(KeyCode.Space) && isFalling == false)
{
GetComponent.<Rigidbody>().velocity.y = jumpHeight;
isFalling = true;
}
}
function OnCollisionStay ()
{
isFalling = false;
}