diff --git a/js/game.js b/js/game.js new file mode 100644 index 0000000..6370f2a --- /dev/null +++ b/js/game.js @@ -0,0 +1,29 @@ +document.addEventListener("DOMContentLoaded", function() { + // Function to show an element + function showElement(selector) { + const element = document.querySelector(selector); + if (element) { + element.style.display = 'block'; + } + } + + // Function to randomly select a customer + function showRandomCustomer() { + const customers = ['#customer1 img', '#customer2 img', '#customer3 img']; + const randomIndex = Math.floor(Math.random() * customers.length); + showElement(customers[randomIndex]); + } + + // Show all dishes + showElement('#mapo-tofu img'); + showElement('#roast-duck img'); + showElement('#yangzhou-fried-rice img'); + showElement('#braised-prawns img'); + showElement('#kung-pao-chicken img'); + + // Show a random customer + showRandomCustomer(); + + // Show normal Qin Shi Huang + showElement('#qinshihuang img'); +});