728x90 반응형 Unity/2D9 [Unity]2D게임만들기 #4_ 플레이어 점프 구현 물리력에 의한 점프 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 public class PlayerMove : MonoBehaviour { public float maxSpeed; public float jumpPower; Rigidbody2D rigid; SpriteRenderer spriteRenderer; Animator anim; void Awake() { rigid = GetComponent(); rigid.freezeRotation = true; spriteRenderer = GetComponent (); anim = GetComponent(); } // 키보드에서 손을 뗐을 때 완전 stop -->멈출 때 속도 p.. 2021. 9. 26. [Unity] 2D게임 만들기 #3-2_ 플레이어 이동과 애니메이션 순환/ 애니메이터 이용해서 플레이어 멈추고 걷기 구현 플레이어 방향전환 Sprite Renderer의 Flip 옵션을 이용해서 오른쪽 방향키를 누르면 플레이어가 오른쪽을 향하게, 왼쪽 방향키를 누르면 왼쪽으로 향하게 해줄 것이다. cf) Flip : 스프라이트 뒤집는 옵션 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMove : MonoBehaviour { public float maxSpe.. 2021. 9. 6. [Unity]2D게임만들기 #3_플레이어 이동,저항설정 / 리지드바디 오브젝트가 구를 때 해결방법/fixedUpdate와 Update의 차이점 물리이동 - player 양옆으로 이동 + 속도조절 PlayerMove 스크립트를 만들어준 후, Player 객체에 넣어준다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMove : MonoBehaviour { Rigidbody2D rigid; void Awake() { rigid = GetComponent(); } // Update is called once per frame void FixedUpdate() { float h = Input.GetAxisRaw("Horizontal"); .. 2021. 8. 30. [Unity]2D게임 만들기 #2 _아틀라스/애니메이션 아틀라스 유니티에서 '아틀라스'는 여러 개의 스프라이트(Sprite)를 한 장의 큰 텍스쳐에 모아놓은 것이라고 볼 수 있다. 쉽게 설명하자면, 에셋 스토어에서 Sprites를 다운 받고 나서 위 사진처럼 이미지를 더블클릭하면 여러개의 이미지가 조각나서 또 나타나는 것을 볼 수 있다. 이걸 하나로 묶어준게 아틀라스이다! 특히 모바일의 경우 아틀라스를 사용해줘야 Batch를 줄여준다 +)Batch : 그래픽을 그리기 위해 메모리와 CPU를 사용한 횟수 https://skuld2000.tistory.com/28 [Unity] 이제 Sprite Packer 는 그만. Sprite Atlas 를 사용하자. 유니티에서 아틀라스(Atlas) 는 여러 개의 스프라이트(Sprite)를 한 장의 큰 텍스쳐에 모아놓은 것이.. 2021. 8. 24. 이전 1 2 3 다음 728x90 반응형