Key input
#HelloGameDev #HelloErmine #HelloWorld2021
Key input
คือ การใช้ปุ่มต่าง ๆ ที่เรากำหนดเพื่อควบคุมตัวละคร โดยให้เราประกาศตัวแปรชื่อปุ่มที่เราจะใช้ เช่น keyW, keyA, keyS, keyD เป็นต้น โดยจะใช้คำสั่ง
ชื่อตัวแปรของเรา = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.ปุ่มที่เราจะใช้)
ตัวอย่าง
หลังจากนั้นให้เรานำไปใช้ใน Update function
Last updated
Was this helpful?