hey i was just wondering if any one has any idears on how i could make it so everytime i take a step the texture changes,the script controlles a plane with a texture of a sprite on it. hear is the movement script thanks in advance
#pragma strict
@script RequireComponent( CharacterController )
var moveTouchPad : Joystick;
var forwardSpeed : float = 4;
var textureNum : int = 0;
private var thisTransform : Transform;
private var character : CharacterController;
function Start()
{
thisTransform = GetComponent( Transform );
character = GetComponent( CharacterController );
var spawn = GameObject.Find( “PlayerSpawn” );
if ( spawn )
thisTransform.position = spawn.transform.position;
}
function OnEndGame()
{
moveTouchPad.Disable();
this.enabled = false;
}
function Update()
{
var movement = thisTransform.TransformDirection( Vector3( moveTouchPad.position.x, 0, moveTouchPad.position.y ) );
movement.y = 0;
movement.Normalize();
var absJoyPos = Vector2( Mathf.Abs( moveTouchPad.position.x ), Mathf.Abs( moveTouchPad.position.y ) );
if ( absJoyPos.y >= absJoyPos.x )
{
if ( moveTouchPad.position.y > 0 )
{
movement = Vector3.forward * forwardSpeed * Time.deltaTime;
guiText.text = “texture:”+ textureNum;
textureNum ++;
guiText.text = “texture:”+ textureNum;
textureNum --;
guiText.text = “texture:”+ textureNum;
}
else if ( moveTouchPad.position.y < 0 )
{
movement = -Vector3.forward * forwardSpeed * Time.deltaTime;
}
}
else if ( absJoyPos.x > absJoyPos.y )
{
if ( moveTouchPad.position.x > 0 )
{
movement = Vector3.right * forwardSpeed * Time.deltaTime;
}
else if ( moveTouchPad.position.x < 0 )
{
movement = Vector3.left * forwardSpeed * Time.deltaTime;
}
}
character.Move( movement );
}