Hầu hết trong số này là có khả năng quen thuộc với bạn thế này:
1. Như đã đề cập trước đó, bạn nên thiết kế các thành phần chuyển động để chấp nhận
nhiều nguồn dữ liệu. Cách đơn giản nhất để làm điều đó là bằng cách cung cấp một CGPoint để
đại diện cho hướng hiện tại của phong trào. Không có vấn đề gì kiểm soát nguồn bạn
sử dụng, nó sẽ có thể chuyển đổi các hướng dẫn phong trào một CGPoint.
2. Bạn lưu trữ hướng cuối cùng của phong trào để cho các cầu thủ rơi trở lại một nhàn rỗi
nhà nước trong khi duy trì sự chỉ đạo của nhân vật hiện đang phải đối mặt.
3. Bạn cần một liên kết để các thành phần sprite để cập nhật vị trí của nó dựa trên
chuyển động có tính toán của các nhân vật.
4. Bạn cũng cần một liên kết để các thành phần hoạt hình để cập nhật trạng thái của nó giữa
đi bộ và nhàn rỗi, cũng như sự chỉ đạo của các hình ảnh động.
Lưu ý: Lưu ý bạn nhìn lên các sprite và hình ảnh động các thành phần lên động
ở đây. Một cách khác là để vượt qua tham chiếu đến các thành phần trong
initializer, nhưng điều này là linh hoạt hơn.
Dưới sự biến dụ, thêm chức năng này:
đang được dịch, vui lòng đợi..