RE: 'Making A Game' - Learning to Code

You are viewing a single comment's thread:

The error must be around here, I think.

 <li><a href="#" onclick="exploreTown('north')">Go North</a>li>
        <li><a href="#" onclick="exploreTown('east')">Go East</a>li>
        <li><a href="#" onclick="exploreTown('south')">Go South</a>li>
        <li><a href="#" onclick="exploreTown('west')">Go West</a>li>
function exploreTown(x, y) {
    const currentLocation = `${x}_${y}`; // Current location coordinates
    if (gameMap[currentLocation]) {
        // Location exists
        displayLocation(currentLocation);
    } else {
        console.log('Invalid location.');
    }
}```


0
0
0.000
2 comments
avatar

I'm about to sit down after dinner and play around with this to see if I can correct my error.

0
0
0.000