mirror of
https://github.com/MrEidam/PetPet.git
synced 2026-04-17 15:43:31 +00:00
First Dice game; 2048 for mobile partialy; Shadows and custom background in rock paper scissors
This commit is contained in:
17
Games/QuessNumber-1D6/main.js
Normal file
17
Games/QuessNumber-1D6/main.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const dice = document.querySelector('#dice'); //img
|
||||
let answear = document.querySelector('#answear'); //text ans
|
||||
let number = document.querySelector('#num'); //num selec
|
||||
|
||||
function roll(){
|
||||
let newDice = Math.floor(Math.random()*6);
|
||||
|
||||
console.log(newDice);
|
||||
|
||||
dice.src = `./${newDice+1}.png`;
|
||||
|
||||
if(number.value == newDice+1){
|
||||
answear.innerHTML = `<p class='won'>Correct! +10 coins</p>`;
|
||||
}else{
|
||||
answear.innerHTML = `<p class='lose'>Wrong!</p>`
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user