game-loop
A game loop for browser.
Quick start
Include game-loop from CDN.
<script src="https://cdn.jsdelivr.net/npm/@pbuk/game-loop@1"></script>
Create the callbacks that define the game.
const config = {
};
const getInitialState = (config) => {
return {
};
};
const update = ({ config, state, frameLength, runTime, gameState }) => {
};
const render = ({ config, state, frameLength, runTime, gameState }) => {
};
Create and manage the game loop.
const { start, stop, reset } = GameLoop.createGame({ config, getInitialState, update, render });
start();
stop();
reset();