From 070794daf2dfe1169f3125a34d78dbe21205abd3 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Jan 2024 01:12:48 +0100 Subject: [PATCH] naprawa malego bledu --- app/src/components/Hero.jsx | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/app/src/components/Hero.jsx b/app/src/components/Hero.jsx index 0051e68..87089ac 100644 --- a/app/src/components/Hero.jsx +++ b/app/src/components/Hero.jsx @@ -19,6 +19,7 @@ const Hero = () => { let number_of_defenders = 0; let number_of_strikers = 0; let number_of_goalkeepers = 0; + let numer_od_shooters = 0; var eX = " "; @@ -177,15 +178,7 @@ const Hero = () => { }) } function whileMove(ball){ - - var ev = document.getElementById('footballField') - var bojo = document.getElementById('footballField') - var bnd = ev.target.getBoundingClientRect() - var x = ((ev.clientX - bnd.left)/bojo.offsetWidth)*100; - var y = ((ev.clientY - bnd.top)/bojo.offsetHeight)*100; - - ball.style.left = x + "%" - ball.style.top = y + "%" + } // Wysłanie zapytania do serwera @@ -224,11 +217,11 @@ const Hero = () => { //dodanie zawodnika do listy oraz punktu do mapy w zaleznosci od aktywnosci przycisku 1,2,3 lub 4 if(active_bbt=="bbt1"){ - let existingBall = document.querySelector('.football'); - if(!existingBall){ + if(numer_od_shooters < 1 ){ addPlayer(0,ball) bojo.appendChild(ball) ball.style.background = "#fc0303" + umer_od_shooters = numer_od_shooters + 1 }else{alert("mozesz dodac tylko jednego strzelca")} }else if(active_bbt == "bbt2"){