oye, tengo un elemento de lienzo donde hay barcos y necesitaría exactamente lo mismo que aquí en el ejemplo https://codepen.io/pierrebleroux/pen/gGpvxJ sin marcos pero no sé cómo hacerlo
aquí está mi código https://codepen.io/cleks/pen/xxrzbLQ
función de movimiento
function handleMouseDown(e){ mouseX=parseInt(e.clientX-offsetX); mouseY=parseInt(e.clientY-offsetY); // mousedown stuff here lastX=mouseX; lastY=mouseY; mouseIsDown=true; } function handleMouseUp(e){ mouseX=parseInt(e.clientX-offsetX); mouseY=parseInt(e.clientY-offsetY); // mouseup stuff here mouseIsDown=false; } function handleMouseMove(e){ if(!mouseIsDown){ return; } mouseX=parseInt(e.clientX-offsetX); mouseY=parseInt(e.clientY-offsetY); // mousemove stuff here for(var i=0;i<ships.length;i++){ var ship=ships[i]; drawShip(ship); if(ctx.isPointInPath(lastX,lastY)){ ship.x+=(mouseX-lastX); ship.y+=(mouseY-lastY); ship.right=ship.x+ship.width; ship.bottom=ship.y+ship.height; } } lastX=mouseX; lastY=mouseY; drawAllShips(); }