Good people see if you can help me I have a "class" called bar that you pass over a box is created but does not move and I would like to know why
caja=document.getElementById("caja");
caja.style.width = "800px";
caja.style.height = "600px";
caja.style.backgroundColor = "rgb(0, 0, 0)";
pelota = new Pelota();
pelota.crearBola();
//clearInterval(pelota.intervalo);
raqueta = new Barra();
raqueta.crearBarra();
caja.onmousemove=function (elEvento){
eventoBarra = window.event||elEvento;
cx = eventoBarra.clientX;
cy = eventoBarra.clientY;
console.log("Cliente X "+cx+" Cliente Y "+cy);
if (cx >= 0 && cx <= parseInt(caja.style.width) - parseInt(raqueta.width)){
raqueta.left= cx;
console.log("Valor del ancho de la barra: "+raqueta.left);
//contLeftBarra = cx;
//informacionDelJuego();
}
}
function Barra(){
this.width=100;
this.height=20;
this.left=380;
this.top=520;
} Barra.prototype.crearBarra = function (elEvento) { this.barra = document.createElement ("div"); // we create the bar in the game environment this.barra.style.height = this.height + "px"; this.barra.style.width = this.width + "px"; this.barra.style.backgroundColor="# 9a0827"; this.barra.style.position="absolute"; this.barra.style.left = this.left + "px"; this.barra.style.top = this.top + "px"; this.barra.style.borderRadius="1em"; caja.appendChild (this.barra);
}