Codemaxxers / Issues

0 stars 0 forks source link

Map Coordinates #74

Open lunaiwa opened 7 months ago

lunaiwa commented 7 months ago

Finding the Player Coordinates Based on the Map Image

`// getting player position relative to the background function getPlayerPosition() { var background = document.getElementById('background'); var player = document.getElementById('player');

        var backgroundRect = background.getBoundingClientRect();
        var playerRect = player.getBoundingClientRect();

        var playerX = playerRect.left - backgroundRect.left;
        var playerY = playerRect.top - backgroundRect.top;

        console.log("Player position relative to background: (" + playerX + ", " + playerY + ")");
    }`

Current Plan: Code it onto the tutorial and see if the coordinates are shown