Spaces:
Running
Running
File size: 5,359 Bytes
e6bd255 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fishing Game</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: linear-gradient(180deg, #87CEEB 0%, #1E90FF 100%);
font-family: Arial, sans-serif;
}
.header {
position: fixed;
top: 20px;
text-align: center;
width: 100%;
color: white;
z-index: 1000;
}
.title {
font-size: 24px;
font-weight: bold;
margin-bottom: 5px;
}
.subtitle {
font-size: 16px;
margin-bottom: 5px;
}
.link {
font-size: 14px;
color: white;
}
.game-container {
width: 800px;
height: 600px;
background: rgba(255, 255, 255, 0.1);
border-radius: 20px;
position: relative;
overflow: hidden;
}
.hook {
width: 20px;
height: 20px;
background: #FFD700;
border-radius: 50%;
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
cursor: pointer;
z-index: 100;
transition: all 0.3s ease;
}
.fish {
width: 40px;
height: 20px;
background: #FF6B6B;
border-radius: 20px;
position: absolute;
transition: all 0.5s linear;
}
.score-board {
position: absolute;
top: 20px;
left: 20px;
background: rgba(255, 255, 255, 0.2);
padding: 10px 20px;
border-radius: 10px;
color: white;
}
.line {
position: absolute;
width: 2px;
background: #FFD700;
top: 0;
left: 50%;
transform: translateX(-50%);
transition: all 0.3s ease;
}
</style>
</head>
<body>
<div class="header">
<div class="title">MOUSE Autonomous 'Sticky Game'</div>
<div class="subtitle">"One-minute creation by AI Coding Autonomous Agent MOUSE"</div>
<a href="https://VIDraft-mouse1.hf.space" class="link">https://VIDraft-mouse1.hf.space</a>
</div>
<div class="game-container">
<div class="score-board">Score: <span id="score">0</span></div>
<div class="line"></div>
<div class="hook"></div>
</div>
<script>
const gameContainer = document.querySelector('.game-container');
const hook = document.querySelector('.hook');
const line = document.querySelector('.line');
const scoreElement = document.getElementById('score');
let score = 0;
let isHookDown = false;
let hookPosition = 0;
function createFish() {
const fish = document.createElement('div');
fish.className = 'fish';
fish.style.top = Math.random() * (gameContainer.offsetHeight - 50) + 'px';
fish.style.left = '-50px';
gameContainer.appendChild(fish);
const speed = 2 + Math.random() * 3;
const movement = setInterval(() => {
const currentLeft = parseInt(fish.style.left);
if (currentLeft > gameContainer.offsetWidth) {
clearInterval(movement);
fish.remove();
} else {
fish.style.left = currentLeft + speed + 'px';
if (isHookDown) {
const hookRect = hook.getBoundingClientRect();
const fishRect = fish.getBoundingClientRect();
if (
hookRect.left < fishRect.right &&
hookRect.right > fishRect.left &&
hookRect.top < fishRect.bottom &&
hookRect.bottom > fishRect.top
) {
score += 10;
scoreElement.textContent = score;
clearInterval(movement);
fish.remove();
pullHook();
}
}
}
}, 20);
}
function pullHook() {
isHookDown = false;
hook.style.top = '0px';
line.style.height = '0px';
}
gameContainer.addEventListener('click', (e) => {
if (!isHookDown) {
isHookDown = true;
const clickY = e.clientY - gameContainer.getBoundingClientRect().top;
hook.style.top = clickY + 'px';
line.style.height = clickY + 'px';
} else {
pullHook();
}
});
setInterval(createFish, 2000);
</script>
</body>
</html> |