Bien au dessus de Léandre et JL
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
2.7 KiB

3 years ago
let bac = 1000
let joueur = 100
let mise
3 years ago
const bacDom = document.getElementById("banque_score")
const joueurDom = document.getElementById("joueur_score")
const tirageDom = document.getElementById("tirage")
bacDom.innerText = bac
joueurDom.innerText = joueur
3 years ago
function jeu(){
3 years ago
mise = parseInt(document.getElementById("input").value)
3 years ago
if(mise > 100 || mise < 0 || mise > joueur){
3 years ago
console.log("erreur: pas possible jouer")
3 years ago
return
}
joueur -= mise
bac += mise
3 years ago
3 years ago
let tirage = [2,1,2]//[nbAlea(), nbAlea(), nbAlea()];
tirageDom.innerText = tirage
3 years ago
3 years ago
let gain_retour = gain(tirage)
console.log(gain_retour)
3 years ago
bac -= gain_retour
3 years ago
bacDom.innerText = bac
3 years ago
joueur += gain_retour
3 years ago
joueurDom.innerText = joueur
3 years ago
if(bac < 500){
3 years ago
console.log("fin de partie")
3 years ago
}
}
function nbAlea(){
3 years ago
let multiples = [36,72,108,144,180,216,252,288,324]
return multiples[Math.floor(Math.random()*9)];
3 years ago
}
function gain(tirage){
if(tirage[0] == 9 &&
tirage[1] == 9 &&
3 years ago
tirage[2] == 9){
return bac
}
else if(tirage[0] == tirage[1] &&
tirage[1] == tirage[2]){
return mise*6
}
else if(tirage[0] == tirage[1] ||
tirage[0] == tirage[2] ||
tirage[1] == tirage[2]){
return mise*3
}
return 0
}
function regles(){
3 years ago
//afficher règles
3 years ago
}
function rotate(rouleau, angle){
let i = 0;
3 years ago
let id = setInterval(() => {
if (i >= angle) clearInterval(id);
else {
i += 9;
rouleau.style.transform = 'rotate3d(1,0,0,'+i+'deg)';
}
3 years ago
}, 5);
// let i = 1;
// let interval = setInterval(() => {
// if(i >= angle) {
// clearInterval(interval); rouleau.style.transform = "rotate3d(1, 0, 0, "+angle+"deg)"
// }
// rouleau.style.transform = "rotate3d(1, 0, 0, "+i+"deg)"
// i += 5
// }, 1)
3 years ago
}
function tirage(){
3 years ago
rotate(document.getElementsByClassName("cube")[0], Math.floor(Math.random() * 15)*360+nbAlea())
rotate(document.getElementsByClassName("cube")[1], Math.floor(Math.random() * 15)*360+nbAlea())
rotate(document.getElementsByClassName("cube")[2], Math.floor(Math.random() * 15)*360+nbAlea())
3 years ago
}
tirage()
3 years ago
function vw(v) {
var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
return (v * w) / 100;
}
window.onresize = () => {
let cubes = document.getElementsByClassName('cube__face')
for (var i = 0; i < 10; i++) {
/*window.getComputedStyle(cubes[i])*/cubes[i].style.transform =
'rotateX('+i*36+'deg) translateZ('+vw(3.4)*Math.tan(18 * Math.PI / 180)+')';
console.log(window.getComputedStyle(cubes[i]).transform)
}
}