andevengine
The small 2D TypeScript engine behind the games on this site. It is small on purpose: just enough to understand every piece.
What I explored
- A requestAnimationFrame loop with delta time in seconds
- Keyboard and mouse input as a set of pressed keys
- 2D vectors and, in each game, AABB, circle–rectangle and restitution-based collisions
- A linearly interpolated camera in Angry Blocks
private readonly loop = (currentTime: number): void => {
const deltaTime = (currentTime - this.previousTime) / 1000;
this.previousTime = currentTime;
this.update(deltaTime);
this.render();
this.animationFrameId = requestAnimationFrame(this.loop);
};