Browse Source

ouaaaaouuuuuaah ah a

master
BARRAUX Arthur 3 years ago
parent
commit
5cad9f10ac
  1. 17
      app.js
  2. 4
      index.html
  3. 25
      master.css
  4. BIN
      tirette.png

17
app.js

@ -20,8 +20,7 @@ function rotate(rouleau, angle){
let i = 0; let i = 0;
let interval = setInterval(() => { let interval = setInterval(() => {
if (i >= angle){ if (i >= angle){
rouleau.style.transform = 'rotate3d(1,0,0,'+angle+'deg)'; clearInterval(interval);
clearInterval(interval);
} }
else { else {
i += 9; i += 9;
@ -41,6 +40,7 @@ function tirette(){
document.getElementById('tirette').style.transform = 'rotate3d(1,0,0,'+(360-i)+'deg)'; document.getElementById('tirette').style.transform = 'rotate3d(1,0,0,'+(360-i)+'deg)';
} }
else { else {
document.getElementById('tirette').style.transform = 'rotate3d(1,0,0,'+i+'deg)'; document.getElementById('tirette').style.transform = 'rotate3d(1,0,0,'+i+'deg)';
} }
i += 9; i += 9;
@ -50,9 +50,10 @@ function tirette(){
function tirage(){ function tirage(){
let numbers = [nbAlea(), nbAlea(), nbAlea()] let numbers = [nbAlea(), nbAlea(), nbAlea()]
rotate(document.getElementsByClassName("cube")[0], (Math.floor(Math.random()*15)*360) - (numbers[0]*36)); console.log(numbers);
rotate(document.getElementsByClassName("cube")[1], (Math.floor(Math.random()*15)*360) - (numbers[1]*36)); rotate(document.getElementsByClassName("cube")[0], Math.floor(Math.random()*(15-1)+1)*360 - numbers[0]*36);
rotate(document.getElementsByClassName("cube")[2], (Math.floor(Math.random()*15)*360) - (numbers[2]*36)); rotate(document.getElementsByClassName("cube")[1], Math.floor(Math.random()*(15-1)+1)*360 - numbers[1]*36);
rotate(document.getElementsByClassName("cube")[2], Math.floor(Math.random()*(15-1)+1)*360 - numbers[2]*36);
return numbers return numbers
} }
@ -88,16 +89,16 @@ function gain(tirage){
if(tirage[0] == 9 && if(tirage[0] == 9 &&
tirage[1] == 9 && tirage[1] == 9 &&
tirage[2] == 9){ tirage[2] == 9){
return bac return game.bac
} }
else if(tirage[0] == tirage[1] && else if(tirage[0] == tirage[1] &&
tirage[1] == tirage[2]){ tirage[1] == tirage[2]){
return mise*6 return game.mise*6
} }
else if(tirage[0] == tirage[1] || else if(tirage[0] == tirage[1] ||
tirage[0] == tirage[2] || tirage[0] == tirage[2] ||
tirage[1] == tirage[2]){ tirage[1] == tirage[2]){
return mise*3 return game.mise*3
} }
return 0 return 0
} }

4
index.html

@ -54,14 +54,12 @@
</div> </div>
</div> </div>
<input type="text" id="mise_input">
</img> </img>
<p>Banque : <span id="banque_score">1000</span></p> <p>Banque : <span id="banque_score">1000</span></p>
<p>Vous : <span id="joueur_score"></span></p> <p>Vous : <span id="joueur_score"></span></p>
<input type="text" id="mise_input">
<button id="lancer" onclick="jeu()">Lancer</button>
<div class="regles"> <div class="regles">
<div class="regles-container"> <div class="regles-container">
Règles Règles

25
master.css

@ -32,28 +32,41 @@ body{
} }
#rouleau_1{ #rouleau_1{
left: 42.65%; left: 42.65vw;
} }
#rouleau_2{ #rouleau_2{
left: 47.05%; left: 47.05vw;
} }
#rouleau_3{ #rouleau_3{
left: 51.5%; left: 51.5vw;
} }
#tirette{ #tirette{
position: absolute; position: absolute;
z-index: 10; z-index: 10;
margin-left: 30.6%; margin-left: 58vw;
top: 3vw;
transform-origin: 70% 58%; transform-origin: 70% 58%;
} }
img { #tirage{
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
margin: auto; margin: auto;
position: relative; position: relative;
width: 42.4%; width: 42.4vw;
}
#mise_input{
position: absolute;
top: 27vw;
left: 42vw;
width: 13vw;
height: 2vw;
border-radius: 20px;
border: none;
box-shadow: 0px 0px 37px black;
} }

BIN
tirette.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Loading…
Cancel
Save