rajout etienne

master
Maël#GEEK#KingBurger#kouyk4 Maël#GEEK#KingBurger#kouyk4 4 years ago
parent f784098151
commit ef7d533101

@ -0,0 +1,172 @@
#barre_nav{
background: black;
height: 56px;
/*padding-top: 5px;*/
vertical-align: center;
}
#titre{
font-family: "Lucida Console", Courier, monospace;
text-shadow: white 0 -1px;
}
#navbarSupportedContent{
margin: 8px;
}
.nav-item:hover{
background-color: orange;
border-radius: 10px;
width: 70%;
}
#image_ballon{
margin-bottom: 5px;
}
body{
background-color: #303030;
overflow-x: scroll;
overflow-y: scroll;
}
.collapse.width,
.collapsing.width {
max-width: 0;
min-width: 0;
width: 0;
transition: all .2s ease;
}
.collapse .flex-column {
overflow: auto;
flex-wrap: nowrap; /* Optional, if you don't want the links to form columns if they overflow */
}
.collapse .flex-column li {
width: 100%;
}
.feather {
width: 16px;
height: 16px;
vertical-align: text-bottom;
}
.sidebar {
width: 20%;
margin-top: 56px;
position: fixed;
top: 0;
bottom: 0;
right: 0;
z-index: 100; /* Behind the navbar */
padding: 48px 0 0; /* Height of navbar */
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
background-color: #b9b7b7;
}
@media (max-width: 767.98px) {
.sidebar {
top: 5rem;
}
}
.sidebar-sticky {
position: relative;
top: 0;
height: calc(100vh - 48px);
padding-top: .5rem;
overflow-x: hidden;
overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
}
@supports ((position: -webkit-sticky) or (position: sticky)) {
.sidebar-sticky {
position: -webkit-sticky;
position: sticky;
}
}
.sidebar .nav-link {
font-weight: 500;
color: #333;
}
.sidebar .nav-link .feather {
margin-right: 4px;
color: #999;
}
.sidebar .nav-link.active {
color: #007bff;
}
.sidebar .nav-link:hover .feather,
.sidebar .nav-link.active .feather {
color: inherit;
}
.sidebar-heading {
font-size: .75rem;
text-transform: uppercase;
}
#list-home-list{
height: 50px;
width: 49%;
}
#ul{
padding-left: 15px;
padding-right: 15px;
}
#list-home-list{
padding-right:10px;
width: 99%
}
#bouton{
margin-left: 15px;
}
#arbre{
height: 150px;
width: 80%;
}
#sidebarMenu{
min-width: 50px;
}
#terrain{
margin-top: 2%;
margin-left: 5%;
width: 75%;
height: auto;
}
#demiTerrainDroit{
margin-top: 2%;
margin-left: 20%;
width: 75%;
height: auto;
}
#demiTerrainGauche{
margin-top: 2%;
margin-left: 20%;
width: 75%;
height: auto;
/*transform: rotate(90deg);*/
}
.boutons {
margin-top: 1%;
}
#bouttonadd: hover {
background-color : "red";
border-color: "yellow";
}
#bouttonadd:active{
box-shadow: 1px 1px 10px black inset, 0 1px 0 rgba( 255, 255, 255, 0.4);
}

@ -0,0 +1,225 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="basket.css">
<title>Basket</title>
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-light" id="barre_nav">
<div id="titre">
<img id="image_ballon" src="ballon.png" width="30" height="30" alt="">
<a class="navbar-brand text-white" href="#">BASKET</a>
</div>
<button class="navbar-toggler bg-light" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link text-white" href="#">Connexion <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="#">Galerie</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle text-white" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Nouvelle page
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" id="demo" href="#" onclick="afficherDemiTerrainDroit()">TERRAIN DROIT</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item " href="#" onclick="afficherDemiTerrainGauche()">TERRAIN GAUCHE</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item " href="#" onclick="afficherFullTerrain()" >FULL TERRAIN</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle text-white" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Partager
</a>
<div class="dropdown-menu text-white" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">PDF</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">JPG</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="#">Sauvegarder</a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block sidebar collapse">
<div class="row list-group list-group">
<div >
<div class="list-group list-group-horizontal" id="bouton" role="tablist">
<a class="list-group-item list-group-item-action active" id="list-home-list" data-toggle="list" href="#list-home" role="tab" aria-controls="home">CREATION
</a>
<a class="list-group-item list-group-item-action" data-toggle="list" id="list-tab" href="#list-profile" role="tab" aria-controls="profile">VUE ARBRE
</a>
</div>
</div>
<div>
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show active" id="list-home" role="tabpanel" aria-labelledby="list-home-list">
<div class="sidebar-sticky pt-3">
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted font-weight-bold">
<span>AJOUTER JOUEUR</span>
<a class="d-flex align-items-center text-muted" href="#" aria-label="Add a new report">
<span data-feather="plus-circle"></span>
</a>
</h6>
<ul class="nav flex-column" id="ul">
<li class="nav-item">
<a class="nav-link" onclick="ajouterjoueur()" href="#">
<span data-feather="file"></span>
ATTAQUANT
</a>
</li>
<li class="nav-item" id="bouttonadd">
<a class="nav-link " onclick="ajouteradversaire()" href="#">
<span data-feather="shopping-cart"></span>
DÉFENSEUR
</a>
</ul>
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted font-weight-bold">
<span>ACTIONS</span>
<a class="d-flex align-items-center text-muted" href="#" aria-label="Add a new report">
<span data-feather="plus-circle"></span>
</a>
</h6>
<ul class="nav flex-column mb-2" id="ul">
<li class="nav-item">
<a class="nav-link" onclick="triggerfairepasse()"href="#">
<span data-feather="file-text"></span>
PASSE
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<span data-feather="file-text"></span>
DÉPLACER
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<span data-feather="file-text"></span>
DRIBBLER
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<span data-feather="file-text"></span>
ÉCRAN
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<span data-feather="file-text"></span>
TIRER
</a>
</li>
<li class="nav-item">
<a class="nav-link" onclick="retourarriere()" href="#">
<span data-feather="file-text"></span>
RETOUR ARRIERE
</a>
</li>
<li class="nav-item">
<a class="nav-link" onclick="triggerdonnerlaballe()" href="#">
<span data-feather="file-text"></span>
DONNER LA BALLE
</a>
</li>
</ul>
</div>
</div>
<div class="tab-pane fade" id="list-profile" role="tabpanel" aria-labelledby="list-profile-list">
<div class="sidebar-sticky pt-3">
<ul class="nav flex-column" id="ul">
<li class="nav-item">
<a class="nav-link active" href="#">
<span data-feather="home"></span>
<span class="sr-only">(current)</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<span data-feather="file"></span>
<img id="arbre" src="arbre.PNG" width="30" height="30" alt="">
</a>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</nav>
<div class="boutons">
<button type="button" class="btn btn-warning">
<img src="flèche_gauche.png" height="30">
</button>
<button type="button" class="btn btn-warning">
<img src="flèche_droite.png" height="30">
</button>
</div>
<div id="divTerrains">
<canvas id="terrain" style="display:block;"></canvas>
<script src ="Terrains/Horizontal/entier.js"></script>
<canvas id="demiTerrainDroit" style="display:none;"></canvas>
<script src ="Terrains/Horizontal/demiDroit.js"></script>
<canvas id="demiTerrainGauche" style="display:none;"></canvas>
<script src ="Terrains/Horizontal/demiGauche.js"></script>
</div>
<script>
function afficherFullTerrain() {
document.getElementById("terrain").style.display = "block";
document.getElementById("demiTerrainDroit").style.display = "none";
document.getElementById("demiTerrainGauche").style.display = "none";
}
function afficherDemiTerrainDroit() {
document.getElementById("terrain").style.display = "none";
document.getElementById("demiTerrainDroit").style.display = "block";
document.getElementById("demiTerrainGauche").style.display = "none";
}
function afficherDemiTerrainGauche() {
document.getElementById("terrain").style.display = "none";
document.getElementById("demiTerrainDroit").style.display = "none";
document.getElementById("demiTerrainGauche").style.display = "block";
}
</script>
<button type="button" class="btn btn-warning fixed-bottom font-weight-bold">+</button>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="rectest.js"></script>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.min.js" integrity="sha384-w1Q4orYjBQndcko6MimVbzY0tgp4pWB4lZ7lr30WKz0vr/aWKhXdBNmNb5D92v7s" crossorigin="anonymous"></script>
</body>
</html>

@ -0,0 +1,584 @@
// get canvas related references
var canvas = document.getElementById("terrain");
var ctx = canvas.getContext("2d");
var BB = canvas.getBoundingClientRect();
var offsetX = BB.left;
var offsetY = BB.top;
canvas.width = window.innerWidth*0.74;
var lt = canvas.width;
canvas.height = lt*0.536;
var ht = canvas.height;
var WIDTH = canvas.width;
var HEIGHT = canvas.height;
// drag related variables
var dragok = false;
var startX;
var startY;
//variable pour donner le ballon
var ball = false;
var nbball=0;
var nba = 0;
var nbb = 0;
//variable pour faire une passe
var nbjpass = 0;
var passable = false;
// array de cercle de joueurs
var joueurs = [];
// array de cercle d'adversaire
var adversaire = [];
// array de passes
var passes = [];
// array de numero de joueur pour créér la passe
var jpass = [];
// array d'action pour pouvoir supprimer la derniere
var last = [];
// listen for mouse events
canvas.onmousedown = myDown;
canvas.onmouseup = myUp;
canvas.onmousemove = myMove;
// call to draw the scene
draw();
// draw a single rect
function rect(x, y, w, h) {
ctx.beginPath();
ctx.rect(x, y, w, h);
ctx.closePath();
ctx.fill();
}
function cercle(x,y,z,a,b,c,g) {
ctx.fillStyle = g;
ctx.beginPath();
ctx.arc(x,y,z,a,b,c);
ctx.fill();
}
function ligne(a,b,c,d){
ctx.beginPath();
ctx.moveTo(a, b);
ctx.lineTo(c, d);
ctx.lineWidth= 3;
ctx.stroke();
}
// clear the canvas
function clear() {
ctx.clearRect(0, 0, WIDTH, HEIGHT);
}
// redraw the scene
function draw() {
clear();
ctx.fillStyle = "#FAF7F8";
rect(0, 0, WIDTH, HEIGHT);
faireterrain();
// redraw each rect in the rects[] array
for (var i = 0; i < joueurs.length; i++) {
var r = joueurs[i];
if(r.setball == true){
r.fill = "green";
}
else{
r.fill = "red";
}
ctx.fillStyle = r.fill;
cercle(r.x,r.y,r.rayon,r.cache,r.taille,r.last,r.fill);
}
for (var i = 0; i < adversaire.length; i++) {
var r = adversaire[i];
if(r.setball == true){
r.fill = "green";
}
ctx.fillStyle = r.fill;
cercle(r.x,r.y,r.rayon,r.cache,r.taille,r.last);
}
for (var i = 0; i < jpass.length-1; i=i+2) {
var r = jpass[i];
var z = jpass[i+1];
nbjpass=0;
fairepasse(r,z);
}
for(var i = 0; i < passes.length; i++) {
var r = passes[i];
ligne(r.x.x,r.x.y,r.x2.x,r.y2.y);
}
}
// handle mousedown events
function myDown(e) {
// tell the browser we're handling this mouse event
e.preventDefault();
e.stopPropagation();
// get the current mouse position
var mx = parseInt(e.clientX - offsetX);
var my = parseInt(e.clientY - offsetY);
//console.log(mx);
//console.log(my);
//console.log(ball);
if(ball == true){
dragok = false;
for (var i = 0; i < joueurs.length; i++) {
var r = joueurs[i];
if (mx > r.x - r.rayon && mx < r.x + r.rayon && my > r.y - r.rayon && my < r.y + r.rayon) {
// if yes, set that rects isDragging=true
document.body.style.cursor = 'pointer';
dragok = true;
if (nbball == 0){
r.setball = true;
r.gottheball = true;
nbball = nbball + 1;
last.push({
action : 3,
});
console.log(last);
}
else
window.alert("Un seul ballon sur le terrain");
ball = false;
draw();
}
}
for (var i = 0; i < adversaire.length; i++) {
var r = adversaire[i];
if (mx > r.x - r.rayon && mx < r.x + r.rayon && my > r.y - r.rayon && my < r.y + r.rayon) {
// if yes, set that rects isDragging=true
document.body.style.cursor = 'pointer';
dragok = true;
if (nbball == 0){
r.setball = true;
r.gottheball = true;
nbball = nbball + 1;
last.push({
action : 4,
})
}
else
window.alert("Un seul ballon sur le terrain");
ball = false;
draw();
}
}
ball = false;
}
if(passable == true ){
for (var i = 0; i < joueurs.length; i++) {
var r = joueurs[i];
if (mx > r.x - r.rayon && mx < r.x + r.rayon && my > r.y - r.rayon && my < r.y + r.rayon) {
// if yes, set that rects isDragging=true
document.body.style.cursor = 'pointer';
if (nbjpass == 0){
if(r.gottheball == false){
passable = false;
console.log(nbjpass);
nbjpass = 0;
window.alert("Seulement un joueur qui possede le ballon a un moment peut faire une passe")
}
else
{
r.gottheball = false;
addj(i);
nbjpass=nbjpass+1;
console.log(nbjpass);
}
}
else{
r.gottheball = true;
addj(i);
nbjpass=nbjpass+1;
console.log(nbjpass);
}
if(nbjpass % 2 == 0){
console.log(nbjpass % 2 );
passable=false;
draw();
}
}
}
}
else {
dragok = false;
for (var i = 0; i < joueurs.length; i++) {
var r = joueurs[i];
if (mx > r.x - r.rayon && mx < r.x + r.rayon && my > r.y - r.rayon && my < r.y + r.rayon) {
// if yes, set that rects isDragging=true
document.body.style.cursor = 'pointer';
dragok = true;
r.isDragging = true;
}
}
for (var i = 0; i < adversaire.length; i++) {
var r = adversaire[i];
if (mx > r.x - r.rayon && mx < r.x + r.rayon && my > r.y - r.rayon && my < r.y + r.rayon) {
// if yes, set that rects isDragging=true
document.body.style.cursor = 'pointer';
dragok = true;
r.isDragging = true;
}
}
}
// save the current mouse position
startX = mx;
startY = my;
}
// handle mouseup events
function myUp(e) {
// tell the browser we're handling this mouse event
e.preventDefault();
e.stopPropagation();
// clear all the dragging flags
document.body.style.cursor = 'default';
dragok = false;
for (var i = 0; i < joueurs.length; i++) {
joueurs[i].isDragging = false;
}
for (var i = 0; i < adversaire.length; i++) {
adversaire[i].isDragging = false;
}
}
// handle mouse moves
function myMove(e) {
// if we're dragging anything...
if (dragok) {
// tell the browser we're handling this mouse event
e.preventDefault();
e.stopPropagation();
// get the current mouse position
var mx = parseInt(e.clientX - offsetX);
var my = parseInt(e.clientY - offsetY);
// calculate the distance the mouse has moved
// since the last mousemove
var dx = mx - startX;
var dy = my - startY;
// move each rect that isDragging
// by the distance the mouse has moved
// since the last mousemove
for (var i = 0; i < joueurs.length; i++) {
var r = joueurs[i];
if (r.isDragging) {
r.x += dx;
r.y += dy;
}
}
for (var i = 0; i < adversaire.length; i++) {
var r = adversaire[i];
if (r.isDragging) {
r.x += dx;
r.y += dy;
}
}
// redraw the scene with the new rect positions
draw();
// reset the starting mouse position for the next mousemove
startX = mx;
startY = my;
}
}
function ajouterjoueur() {
if (joueurs.length >= 5)
window.alert("Nombre de joueurs maximum atteint");
else {
joueurs.push({
x: 60,
y: 35 + ((joueurs.length + 1) * 50),
rayon: 20,
cache: 0,
taille: Math.PI*2,
last: false,
fill: "red",
isDragging: false,
setball : false,
gottheball : false,
});
last.push({
action : 1,
});
console.log(last);
cercle(60,35 + (joueurs.length * 50),20,0,Math.PI*2,false,"red");
}
}
function ajouteradversaire() {
console.log(adversaire.length);
if (adversaire.length >= 5)
window.alert("Nombre d'adversaire maximum atteint");
else {
adversaire.push({
x: 560,
y: 35 + ((adversaire.length + 1) * 50),
rayon: 20,
cache: 0,
taille: Math.PI*2,
last: false,
fill: "black",
isDragging: false,
setball : false
});
last.push({
action : 2,
});
console.log(last);
cercle(560,35 + (adversaire.length * 50),20,0,Math.PI*2,false,"black");
}
}
function fairepasse(a,b) {
console.log(a);
console.log(b);
passes.push({
x: joueurs[a.c],
y: joueurs[a.c],
x2 : joueurs[b.c],
y2 : joueurs[b.c],
});
// console.log("passe stp");
jpass.pop();
jpass.pop();
last.push({
action : 5,
depart : a.c,
arrivé : b.c,
});
console.log(last);
ligne(joueurs[a.c].x,joueurs[a.c].y,joueurs[b.c].x,joueurs[b.c].y);
;
}
function faireterrain() {
ctx.lineWidth="5";
//Bordures du terrain
ctx.beginPath();
ctx.rect(0, 0, lt, ht);
ctx.stroke();
ctx.lineWidth="2";
//Ligne centrale
ctx.beginPath();
ctx.moveTo(lt/2, ht);
ctx.lineTo(lt/2, 0);
ctx.stroke();
//Cercle central
ctx.beginPath();
ctx.arc(lt/2, ht/2, lt*0.064, 0, Math.PI*2, false);
ctx.stroke();
/* RAQUETTES */
//Rectangle raquette gauche
ctx.beginPath();
ctx.rect(0, ht/3, lt*0.208, ht/3);
ctx.stroke();
//Rectangle raquette droite
ctx.beginPath();
ctx.rect(lt-lt*0.208, ht/3, lt-lt*0.208, ht/3);
ctx.stroke();
//Cercle raquette gauche
ctx.beginPath();
ctx.arc(lt*0.208, ht/2, lt*0.064, 1.5*Math.PI, 0.5*Math.PI, false);
ctx.stroke();
//Cercle raquette droite
ctx.beginPath();
ctx.arc(lt-(lt*0.208), ht/2, lt*0.064, 0.5*Math.PI, 1.5*Math.PI, false);
ctx.stroke();
/* LIGNES LANCERS FRANCS */
//Ligne lf 1 gauche
ctx.beginPath();
ctx.moveTo(0, 0.06*ht);
ctx.lineTo(lt*0.075, 0.06*ht);
ctx.stroke();
//Ligne lf 2 gauche
ctx.beginPath();
ctx.moveTo(0, 0.94*ht);
ctx.lineTo(lt*0.075, 0.94*ht);
ctx.stroke();
// Cercle lf gauche
ctx.beginPath();
ctx.arc(lt*0.063, ht/2, ht*0.44, 1.5*Math.PI, 0.5*Math.PI, false);
ctx.stroke();
//Ligne lf 1 droite
ctx.beginPath();
ctx.moveTo(lt, 0.06*ht);
ctx.lineTo(lt*0.925, 0.06*ht);
ctx.stroke();
//Ligne lf 2 droite
ctx.beginPath();
ctx.moveTo(lt, 0.94*ht);
ctx.lineTo(lt*0.925, 0.94*ht);
ctx.stroke();
//Cercle lf droite
ctx.beginPath();
ctx.arc(lt*0.937, ht/2, lt*0.236, 0.5*Math.PI, 1.5*Math.PI, false);
ctx.stroke();
/* PANIERS */
//Cercle panier gauche
ctx.beginPath();
ctx.arc(lt*0.063, ht/2, ht*0.083, 1.5*Math.PI, 0.5*Math.PI, false);
ctx.stroke();
//Panier gauche
ctx.beginPath();
ctx.moveTo(lt*0.06, ht*0.44);
ctx.lineTo(lt*0.06, ht*0.56);
ctx.stroke();
ctx.beginPath();
ctx.arc(lt*0.072, ht/2, ht*0.01, 0, Math.PI*2, false);
ctx.stroke();
ctx.beginPath();
ctx.moveTo(lt*0.06, ht/2);
ctx.lineTo(lt*0.067, ht/2);
ctx.stroke();
//Cercle panier droit
ctx.beginPath();
ctx.arc(lt-lt*0.063, ht/2, ht*0.083, 0.5*Math.PI, 1.5*Math.PI, false);
ctx.stroke();
//Panier droit
ctx.beginPath();
ctx.moveTo(lt-lt*0.06, ht-ht*0.44);
ctx.lineTo(lt-lt*0.06, ht-ht*0.56);
ctx.stroke();
ctx.beginPath();
ctx.arc(lt-lt*0.072, ht/2, ht*0.01, 0, Math.PI*2, false);
ctx.stroke();
ctx.beginPath();
ctx.moveTo(lt-lt*0.06, ht-ht/2);
ctx.lineTo(lt-lt*0.067, ht-ht/2);
ctx.stroke();
}
function triggerdonnerlaballe(){
ball = true;
console.log(ball);
}
function triggerfairepasse(){
if(joueurs.length < 2){
window.alert("On ne peut faire une passe si on a pas 2 joueurs")
}
else{
passable = true;
console.log(passable);
}
}
function addj(a){
jpass.push({
c : a,
});
}
function retourarriere(){
console.log(last);
console.log("allo");
x = last.length;
if(x == 0){
window.alert("Vous ne pouvez revenir en arriere")
}
else{
if(last[x-1].action == 1){
joueurs.pop();
last.pop();
draw();
}
if(last[x-1].action == 2){
adversaire.pop();
last.pop();
draw();
}
if(last[x-1].action == 3){
for (var i = 0; i < joueurs.length; i++) {
var r = joueurs[i];
if(r.setball == true){
r.setball = false;
nbball = nbball - 1;
last.pop();
draw();
}
}
}
if(last[x-1].action == 4){
for (var i = 0; i < adversaire.length; i++) {
var r = adversaire[i];
if(r.setball = true){
r.setball = false;
nbball = nbball - 1;
last.pop();
draw();
}
}
}
if(last[x-1].action == 5){
joueurs[last[x-1].arrivé].gottheball = false;
joueurs[last[x-1].depart].gottheball = true;
last.pop();
passes.pop();
draw();
}
}
}
Loading…
Cancel
Save