Click here for free DL of the app version that can save data.
No:44610 50
Prev Next
Action
Developer User19433|Date and time 24/2/18 18:28:10
Build time 9.271 sec|Game capacity 1.705KB|Script


1. Define the HTML structure


Welcome to the Pictogram Game!

Click on the pictograms to play!



2. Create an array of pictogram image URLs and randomly select one to display in the game container
js const pictograms = ['url1', 'url2', 'url3', 'url4', 'url5']; const gameContainer = document.getElementById('game-container'); function displayRandomPictogram() { gameContainer.innerHTML = ''; const randomIndex = Math.floor(Math.random() * pictograms.length); const pictogramImg = document.createElement('img'); pictogramImg.src=pictograms[randomIndex]; gameContainer.appendChild(pictogramImg); } displayRandomPictogram();
3. Add a click event listener to the pictogram and trigger the display of a new random pictogram when clicked
js pictogramImg.addEventListener('click', function() { displayRandomPictogram(); });
4. Test the game in a browser to see the first pictogram displayed, and click on it to display new random pictograms each time. This simple game allows players to interact with pictograms by clicking on them, triggering the display of new random pictograms in the game container. Players can continue clicking to see different pictograms and enjoy the game experience.

Prev Next   Back  0  0 Menu 

[PR]現在の本の売れ筋ランキング

Click here for free DL of the app version that can save data.

(C)2023 HisashiApp