about summary refs log tree commit diff stats
path: root/html/rogue/js/camera.js
diff options
context:
space:
mode:
Diffstat (limited to 'html/rogue/js/camera.js')
-rw-r--r--html/rogue/js/camera.js56
1 files changed, 0 insertions, 56 deletions
diff --git a/html/rogue/js/camera.js b/html/rogue/js/camera.js
deleted file mode 100644
index e5d5d14..0000000
--- a/html/rogue/js/camera.js
+++ /dev/null
@@ -1,56 +0,0 @@
-const createCamera = (x, y) => ({
-    x,
-    y,
-    width: window.innerWidth,
-    height: window.innerHeight,
-    // Define the dead zone (the area where camera won't move)
-    deadZone: {
-        x: window.innerWidth * 0.3, // 30% of screen width
-        y: window.innerHeight * 0.3, // 30% of screen height
-    }
-});
-
-const updateCamera = (camera, target) => {
-    // Calculate the center point of the screen
-    const screenCenterX = camera.x + camera.width / 2;
-    const screenCenterY = camera.y + camera.height / 2;
-
-    // Calculate the distance from the target to the screen center
-    const distanceX = target.x - screenCenterX;
-    const distanceY = target.y - screenCenterY;
-
-    // Calculate the dead zone boundaries
-    const deadZoneLeft = -camera.deadZone.x / 2;
-    const deadZoneRight = camera.deadZone.x / 2;
-    const deadZoneTop = -camera.deadZone.y / 2;
-    const deadZoneBottom = camera.deadZone.y / 2;
-
-    // Calculate new camera position with smooth following
-    let newX = camera.x;
-    let newY = camera.y;
-
-    // Horizontal camera movement
-    if (distanceX < deadZoneLeft) {
-        newX += distanceX - deadZoneLeft;
-    } else if (distanceX > deadZoneRight) {
-        newX += distanceX - deadZoneRight;
-    }
-
-    // Vertical camera movement
-    if (distanceY < deadZoneTop) {
-        newY += distanceY - deadZoneTop;
-    } else if (distanceY > deadZoneBottom) {
-        newY += distanceY - deadZoneBottom;
-    }
-
-    // Add subtle smoothing to camera movement
-    const smoothing = 0.1;
-    newX = camera.x + (newX - camera.x) * smoothing;
-    newY = camera.y + (newY - camera.y) * smoothing;
-
-    return {
-        ...camera,
-        x: newX,
-        y: newY
-    };
-};
155' href='#n155'>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 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237