naprawa malego bledu

This commit is contained in:
unknown 2024-01-05 01:12:48 +01:00
parent bdafb95511
commit 070794daf2

View File

@ -19,6 +19,7 @@ const Hero = () => {
let number_of_defenders = 0; let number_of_defenders = 0;
let number_of_strikers = 0; let number_of_strikers = 0;
let number_of_goalkeepers = 0; let number_of_goalkeepers = 0;
let numer_od_shooters = 0;
var eX = " "; var eX = " ";
@ -178,14 +179,6 @@ const Hero = () => {
} }
function whileMove(ball){ 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 // 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 //dodanie zawodnika do listy oraz punktu do mapy w zaleznosci od aktywnosci przycisku 1,2,3 lub 4
if(active_bbt=="bbt1"){ if(active_bbt=="bbt1"){
let existingBall = document.querySelector('.football'); if(numer_od_shooters < 1 ){
if(!existingBall){
addPlayer(0,ball) addPlayer(0,ball)
bojo.appendChild(ball) bojo.appendChild(ball)
ball.style.background = "#fc0303" ball.style.background = "#fc0303"
umer_od_shooters = numer_od_shooters + 1
}else{alert("mozesz dodac tylko jednego strzelca")} }else{alert("mozesz dodac tylko jednego strzelca")}
}else if(active_bbt == "bbt2"){ }else if(active_bbt == "bbt2"){