เล่นเกม? ️ | ลีดเดอร์บอร์ด? |
---|---|
![]() | ![]() |
เกมบุกไก่
├── README.md
├── about
│ ├── audio
│ │ └──spaceinvaders1.mpeg
│ └── js
│ └──about.js
└── css
├── App.css # Styles for instructions. Feel free to customize this as you desire.
├── home.css # Styles for index html file
├── leader.css # Styles for leaderboard html file
├──main.css # Styles for game html file
├──js
│ ├──board.js #contains logic for leader-board
│ ├──Config.js #contains the configurations for game loop
│ ├──Enemy.js #contains the Enemy Class
│ ├──Game.js #contains the Game Class
│ ├──Helper.js #contains some Helper functions
│ ├──home.js #contains player creation modal logic
│ ├──Laser.js #contains the Laser Class
│ ├──modal.js #contains the Pause modal logic
│ ├──Player.js #contains the Player Class
│ ├──Present.js #contains the Present Class
├── Images # Helpful images for the app. Use at your discretion.
│ ├── egg.png
│ ├── player-blue-1.png
│ └── laser-blue-1.png
├──sound #contains the game sounds
├── game.html #the game loop ui
├── index.html #the home page ui
├── Instructions.html #the instructions ui
├── leaderboard.html #the leaderboard ui
└── Main.js # You should not need to modify this file. It is used for the game main loop Logic.
มีหน้าที่รับผิดชอบในการสร้างไก่วิธีที่พวกเขาเคลื่อนไหววิธีที่พวกเขาตายและเวลาที่พวกเขายิง
create($container, src)
ฟังก์ชั่นนี้รับผิดชอบการสร้างไก่
destroy($container, enemy)
ฟังก์ชั่นนี้ใช้เพื่อทำลายไก่และลบออกจาก DOM
คลาสนี้ใช้เพื่อสร้างไก่ย่างและต่อท้ายกับ DOM เมื่อไก่ระเบิด
create($container, src)
ฟังก์ชั่นนี้ใช้เพื่อสร้างไก่ย่างและต่อท้ายกับ DOM
destroy($container, enemy)
ฟังก์ชั่นนี้ใช้ในการลบไก่คั่วออกจาก DOM ถ้ามันถูกกินโดยเรืออวกาศหรือเมื่อมันกระทบกับเส้นขอบของเกม
มีหน้าที่รับผิดชอบในการสร้างเลเซอร์ผู้เล่นและเลเซอร์ศัตรู
create(container):
มันมีหน้าที่รับผิดชอบในการสร้างเครื่องเล่นเลเซอร์และผลักเลเซอร์ที่สร้างขึ้นไปยังเลเซอร์อาร์เรย์ในเกมชั้นเรียน
createEnemyLaser(containers):
มันมีหน้าที่รับผิดชอบในการสร้างเลเซอร์ศัตรูและผลักเลเซอร์ที่สร้างขึ้นไปยังอาร์เรย์ enemylaser ในเกมชั้นเรียน
updateLasers(dt,containers):
มันเป็นหน้าที่ของการเคลื่อนย้ายเลเซอร์ผู้เล่นไปในทิศทางที่ถูกต้องและตรวจสอบว่าเลเซอร์กระทบกับศัตรู
destroyLasers(containers,laser):
มันรับผิดชอบในการทำลายเลเซอร์และลบออกจาก DOM
updateEnemyLasers(dt,containers):
มันมีหน้าที่รับผิดชอบในการเคลื่อนย้ายเลเซอร์ศัตรูไปในทิศทางที่ถูกต้องและตรวจสอบว่าเลเซอร์กระทบผู้เล่นและลดชีวิตหากเกิดการชนกัน
คลาสผู้เล่นได้ใช้วิธีการสำหรับการสร้างผู้เล่นอัปเดตตำแหน่งผู้เล่นทำลายผู้เล่นและชนะ
create($container, imgSrc)
สร้างเครื่องเล่นใหม่ (องค์ประกอบ DOM)
update(dt, $container)
อัปเดตตำแหน่งของเครื่องเล่นบนหน้าจอ มันคำนวณระยะทางตามกฎหมายฟิสิกส์: ระยะทาง = เวลา*ความเร็ว
destroy(container, player)
ลบผู้เล่นองค์ประกอบ DOM ออกจากหน้าจอหลังจากถูกโจมตีด้วยอาวุธศัตรู (ไข่)
won()
ส่งคืนจริงถ้าศัตรูทั้งหมดถูกทำลายและไม่มีของขวัญบนหน้าจอ
clamp(v,min,max)
ทำให้ผู้เล่นอยู่ในขีด จำกัด หน้าจอและบังคับให้ผู้เล่นไม่เกินพวกเขา
init()