I'll help you create a simple interactive map game that works on mobile devices. This will use HTML, CSS, and JavaScript. Here's a basic implementation where players need to find and tap hidden locations:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Treasure Map Game</title>
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
touch-action: manipulation;
}
#game-container {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
}
#map {
width: 100%;
height: 100%;
background: #b5916e;
background-image:
radial-gradient(#927556 15%, transparent 16%),
radial-gradient(#927556 15%, transparent 16%);
background-size: 60px 60px;
background-position: 0 0, 30px 30px;
}
.target {
position: absolute;
width: 30px;
height: 30px;
border-radius: 50%;
background: transparent;
border: 2px solid transparent;
transform: translate(-50%, -50%);
}
#score {
position: fixed;
top: 10px;
left: 10px;
background: rgba(255, 255, 255, 0.8);
padding: 10px;
border-radius: 5px;
font-family: Arial, sans-serif;
}
</style>
</head>
<body>
<div id="game-container">
<div id="map"></div>
<div id="score">Score: <span id="score-value">0</span></div>
</div>
<script>
let score = 0;
const totalTargets = 5;
function createTarget() {
const target = document.createElement('div');
target.className = 'target';
const x = Math.random() * 90 + 5; // Keep away from edges
const y = Math.random() * 90 + 5;
target.style.left = x + '%';
target.style.top = y + '%';
target.addEventListener('click', function() {
score++;
document.getElementById('score-value').textContent = score;
this.style.background = '#ff0000';
this.style.border = '2px solid #000';
setTimeout(() => {
this.remove();
if (document.getElementsByClassName('target').length < totalTargets) {
createTarget();
}
if (score >= 10) {
alert('You win! Game Over!');
resetGame();
}
}, 500);
});
document.getElementById('map').appendChild(target);
}
function resetGame() {
score = 0;
document.getElementById('score-value').textContent = score;
const targets = document.getElementsByClassName('target');
while(targets.length > 0) {
targets[0].remove();
}
initializeGame();
}
function initializeGame() {
for(let i = 0; i < totalTargets; i++) {
createTarget();
}
}
initializeGame();
</script>
</body>
</html>
This creates a simple treasure hunt-style game where:
- Players need to find and tap hidden locations on the map
- When a correct location is found, it briefly turns red before disappearing
- New targets appear as old ones are found
- The score is tracked in the top-left corner
- The game ends when the player reaches 10 points
Key features:
- Mobile-friendly with touch support
- Responsive design that works on any screen size
- Simple scoring system
- Randomized target locations
- Visual feedback when targets are found
To enhance this game, you could:
- Add different types of targets worth different points
- Include a timer
- Add sound effects
- Create different levels with varying difficulty
- Add hints or a "hot/cold" indicator
- Include obstacles or decoy targets
Would you like me to modify any of these aspects or add additional features?