using System.Collections; using System.Collections.Generic; using UnityEngine; public class Move : MonoBehaviour { public float maxSpeed; Rigidbody2D rigid; SpriteRenderer spriteRenderer; Animator anim; void Awake() { rigid = GetComponent(); spriteRenderer = GetComponent(); anim = GetComponent(); } void update() { //stopspeed if (Input.GetButtonUp("Horizontal")) { rigid.velocity = new Vector2(rigid.velocity.normalized.x*0.5f, rigid.velocity.y); } //Direction sprite if(Input.GetButtonDown("Horizontal")) spriteRenderer.flipX = Input.GetAxisRaw("Horizontal") == -1; //animation if (Mathf.Abs(rigid.velocity.x) maxSpeed)//right max speed rigid.velocity = new Vector2(maxSpeed, rigid.velocity.y); else if(rigid.velocity.x





๋ฐฉํ–ฅํ‚ค์— ๋”ฐ๋ฅธ ํ”Œ๋ฆฝ ์ „ํ™˜์ด๋ž‘ย  ย ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ „ํ™˜์ด ๋จนํ†ต์ด๋„ค์š”ย 



//Direction sprite if(Input.GetButtonDown("Horizontal")) spriteRenderer.flipX = Input.GetAxisRaw("Horizontal") == -1; //animation if (Mathf.Abs(rigid.velocity.x)

์ด๋ถ€๋ถ„์ด ๋ฌธ์ œ์ธ๊ฒƒ๊ฐ™์€๋ฐ ์•„์‹œ๋Š”๋ถ„