7a62067af1
Vite + React + PixiJS + TypeScript. Features: - 4-level campaign (King's Road → Obsidian Keep) - Isometric 2.5D grid with ley-line mechanics - ECS architecture (entities, components, systems) - 4 tower types, hero spellcaster, 10+ enemy types - Lich King boss with 3-phase AI - Meta-progression: essence, rune unlocks - Full UI redesign with fantasy design system Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
17 lines
624 B
TypeScript
17 lines
624 B
TypeScript
export const lerp = (a: number, b: number, t: number) => a + (b - a) * t
|
|
|
|
export const clamp = (v: number, min: number, max: number) =>
|
|
Math.min(Math.max(v, min), max)
|
|
|
|
export const dist = (ax: number, ay: number, bx: number, by: number) =>
|
|
Math.sqrt((bx - ax) ** 2 + (by - ay) ** 2)
|
|
|
|
export const dist2 = (ax: number, ay: number, bx: number, by: number) =>
|
|
(bx - ax) ** 2 + (by - ay) ** 2
|
|
|
|
export const angleTo = (ax: number, ay: number, bx: number, by: number) =>
|
|
Math.atan2(by - ay, bx - ax)
|
|
|
|
export const toRad = (deg: number) => (deg * Math.PI) / 180
|
|
export const toDeg = (rad: number) => (rad * 180) / Math.PI
|