Hi every one!
I have 2 GUI Buttons one for the right side movement and another for the left side movement and both should play the animation : like walking animation.
what i want is: when the player is going right side and when the left button is pressed the character should flip 180 degree or opposite to the right side movement my camera is set to 2D view. And the camera should not move or flip 180 degree
Here is the code which i am using but i don’t know how to flip the animation or the character.
var Player : GameObject;
var speed = 4.0;
var iconRight : Texture;
var iconLeft :Texture;
function OnGUI ()
{
var screenw=Screen.width/7;
var screenh=Screen.height/2;
var screenw2=Screen.width/70;
if(GUI.RepeatButton(Rect(screenw,screenh+200,80,50 ),GUIContent (iconRight)))
{
Player.transform.Translate(0,0,speed*Time.deltaTim e);
Player.animation.Play("walk");
}
if(GUI.RepeatButton(Rect(screenw2,screenh+200,80,5 0),GUIContent (iconLeft)))
{
Player.transform.Translate(0,0,-speed*Time.deltaTime);
Player.animation.Play("walk");
}
}
what should i use to rotate my character 180 degree
can you all help me please