kaplayjs / kaplay

🦖 A JavaScript/TypeScript Game Library that feels like a game, fun
https://kaplayjs.com
MIT License
575 stars 40 forks source link

fix: fast loop using update #513

Closed dragoncoder047 closed 2 weeks ago

dragoncoder047 commented 2 weeks ago

mostly from https://github.com/kaplayjs/kaplay/issues/35#issuecomment-2126209484 but can run multiple loops per frame, more up to date stuff etc

mostly if the old loop() was had too low an interval, or the game lagged, then the loop() would deadlock on something and freeze the whole browser window, it doesn't seem to do that anymore even when running 10,000 loops per second (>>framerate)

pkg-pr-new[bot] commented 2 weeks ago

Open in Stackblitz

pnpm add https://pkg.pr.new/kaplayjs/kaplay@513

commit: 8e09dea