The question was successfully answered.
Error messages with 2d character sprite flipping and movement.
I'm making a 2d game but when I try to flip the sprites with a code I get errors.
No overload for for method 'Move' takes 1 argument/ the name 'move' doesn't exist in the current context. Please help me fix this or suggest another way of doing it. Here's the script.
void Update () {
     float x = Input.GetAxisRaw("Horizontal");
     float y = Input.GetAxisRaw("Vertical");
     Vector2 direction = new Vector2(x, y).normalized;
     Move (direction);
 }
 void Move (Vector2 direction, float move)
 {
     Vector2 min = Camera.main.ViewportToWorldPoint (new Vector2(0, 0));
     Vector2 max = Camera.main.ViewportToWorldPoint (new Vector2(1, 1));
     max.x = max.x - 0.225f;
     min.x = min.x + 0.225f;
     max.y = max.y - 0.285f;
     min.y = min.y + 0.285f;
     Vector2 pos = transform.position;
     pos += direction * speed * Time.deltaTime;
     pos.x = Mathf.Clamp (pos.x, min.x, max.x);
     pos.y = Mathf.Clamp(pos.y, min.y, max.y);
     transform.position = pos;
     if (move > 0 && !m_FacingRight)
     {
         // ... flip the player.
         Flip();
     }
     // Otherwise if the input is moving the player left and the player is facing right...
     else if (move < 0 && m_FacingRight)
     {
         // ... flip the player.
         Flip();
     }
 }
 private void Flip()
 {
     // Switch the way the player is labelled as facing.
     m_FacingRight = !m_FacingRight;
     // Multiply the player's x local scale by -1.
     Vector3 theScale = transform.localScale;
     theScale.x *= -1;
     transform.localScale = theScale;
 }
 
               }
Answer by jgodfrey · Jul 19, 2016 at 12:06 AM
This....
 Move (direction);
 
               Is calling the local "Move" method. Looking at that method, it requires 2 arguments, but you're only giving it a single argument.
 void Move (Vector2 direction, float move)
 
               So, it needs both a Vector2 and a float. Looking at the code, the 2nd arg just seems to be a float that's analyzed to determine motion direction (positive being right and negative being left). With that in mind, I'd guess you want to change this:
 Move (direction);
 
               to this:
 Move (direction, x);
 
              Thanks sooo much!!! This worked!! Now my papaya can face different directions!! :D
Follow this Question
Related Questions
GameObject overlapping on random spawn 0 Answers
Player rotation 2d 0 Answers
How big is too big for a Character Rig? 0 Answers
Why am I getting this error "Object reference not set to an instance of an object" 1 Answer
Destroying 2D terrain at runtime 0 Answers