CodePen HTML/CSS/JS Advice

Hello! I’m very new to html/css/javascript and need some advice, please.

I cloned a pen from FC Python (who were good enough to share their Pen), however I wanted to alter it for my own purposes. I can’t work out how to make the x,y, coordinates populate from the top left of the pitch as 0,0 as it was originally set up to be 0,0 from the centre of the pitch - I’m not yet up to that level of understanding. Hopefully this makes sense.

Is anyone able to take a look at this for me and if possible suggest how I do this? I have tried various way by reading etc but I don’t fully grasp what I need to do.

Here is my version https://codepen.io/martynphillips1/pen/aQOJzP

Thanks!

        cell2.innerHTML = ((Math.floor(mousePos.x)-10)-100);
		cell3.innerHTML = ((Math.floor(mousePos.y)-10)-133);

change the above lines to the following

		cell2.innerHTML = (Math.floor(mousePos.x)); 
		cell3.innerHTML = (Math.floor(mousePos.y));
		

This is fantastic, thank you! I tried something similar but whatever I was doing didn’t work - thanks for the help :slight_smile:

1 Like