Layer
#HelloGameDev #HelloErmine #HelloWorld2021
Last updated
Was this helpful?
#HelloGameDev #HelloErmine #HelloWorld2021
Last updated
Was this helpful?
layer คือค่าความลึกของ object อันหนึ่ง ซึ่งถ้ามีค่ามาก object ก็จะไปอยู่ข้างหน้า
โดยน้อง ๆ สามารถตั้งค่าความลึกของ layer ได้โดยใช้คำสั่ง .setDepth
เช่น
ผลลัพธ์ที่ได้
และ layer ยังสามารถใช้เพื่อจัดกลุ่ม 'Layer' ของ Game objects เข้าด้วยกันได้อีกด้วย
ตัวอย่าง
ถ้าจัดกลุ่ม
GroupLayer.add([ Object1 , Object2, Object3 ]);
Object ที่อยู่ชื่อแรกจะอยู่หลังสุด
ผลลัพธ์ที่ได้