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 ---
223240function 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) ---
347373const torches = [ ] ;
348374
0 commit comments