Skip to content

Commit 2b81b32

Browse files
author
MoonTech
committed
MicroUpgrades
1 parent dcb8653 commit 2b81b32

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ The New **Screw**, in which, if a object is dragged and pressed Z, a screw will
4242

4343
1. Added Textures to Box and Ash
4444
2. improved TNT
45+
3. Added custom pointer
4546

4647

4748

4849

49-
try at : https://moontech-code1106.github.io/PlyGround/
50+
Try at : https://moontech-code1106.github.io/PlyGround/
5051
-------------

index.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<link rel="icon" href="Logo.png" type="image/png">
77
<title>PlyGround Physics Engine</title>
88
<style>
9+
html {cursor: url('pointer.png'), auto; }
910
body { margin:0; overflow:hidden; background:#0d1117; color:white; font-family:"Segoe UI",sans-serif; }
1011
.navbar { display:flex; align-items:center; justify-content:space-between; background:linear-gradient(90deg,#00ff95,#0077ff); padding:10px 20px; }
1112
.navbar-left { display:flex; align-items:center; }
@@ -218,6 +219,22 @@ <h1>PlyGround Physics Engine</h1>
218219

219220
ctx.restore();
220221
})();
222+
// Track mouse position
223+
let mouseX = 0, mouseY = 0;
224+
225+
window.addEventListener("mousemove", (e) => {
226+
const rect = render.canvas.getBoundingClientRect();
227+
mouseX = e.clientX - rect.left;
228+
mouseY = e.clientY - rect.top;
229+
});
230+
231+
// Listen for 'S' key press
232+
window.addEventListener("keydown", (e) => {
233+
if (e.key.toLowerCase() === 's') {
234+
createFireCluster(mouseX, mouseY, 1); // sizeFactor = 1
235+
}
236+
});
237+
221238

222239
// --- IGNITE & ASH SYSTEM ---
223240
function igniteNearbyBodies() {
@@ -321,6 +338,14 @@ <h1>PlyGround Physics Engine</h1>
321338
}
322339
);
323340

341+
// Apply a random flying force
342+
const forceMagnitude = 0.0005 + Math.random() * 0.0001;
343+
const angle = Math.random() * Math.PI * 2; // random direction
344+
Body.applyForce(frag, frag.position, {
345+
x: Math.cos(angle) * forceMagnitude,
346+
y: Math.sin(angle) * forceMagnitude,
347+
});
348+
324349
World.add(world, frag);
325350
spawnedBodies.push(frag);
326351

@@ -343,6 +368,7 @@ <h1>PlyGround Physics Engine</h1>
343368
}
344369
}
345370

371+
346372
// --- 🔦 TORCH SYSTEM (Dynamic, Textured Torch with Moving Flame) ---
347373
const torches = [];
348374

pointer.png

523 Bytes
Loading

0 commit comments

Comments
 (0)