So I’m trying to make my first game and want a fish to reverse it’s direction near the end of the screen. To change it’s direction I’ve tried altering the variables speed so it moves the other way but not joy. Does any one have any suggestions.
//Inspector Variables
var fish01Speed = 5;
function Update () {
//Starts Movement
transform.Translate(Vector3.up * fish01Speed * Time.deltaTime);
//Checks for walls
if(transform.position.x >= 12)
{
var fish01Speed = -5;
}
}