This commit is contained in:
Schluffe
2026-03-16 23:19:18 +01:00
parent 6e95c538fb
commit a2af7b9940
3 changed files with 29 additions and 24 deletions
+17 -5
View File
@@ -1,21 +1,33 @@
import type { Circle } from "#/engine/Circle.ts";
import $ from "#/engine/Scene.ts";
import type { Vector } from "#/engine/Vector.ts";
export type Collider = {};
const CIRCLE = 0;
const RECT = 1;
const POLYGON = 2;
type Shape = 0 | 1 | 2;
export type Collider<T> = {
shape: Shape;
body: T;
};
export type Collision = {};
export function moveAndCollide(
collider: Collider,
export function moveAndCollide<T>(
collider: Collider<T>,
velocity: Vector,
delta: number,
): Collision {}
): Collision {
return {};
}
export function processPhysics(
ctx: CanvasRenderingContext2D,
delta: number,
): void {
for (const [id, collider] of $<Collider>("collider")!.entries()) {
for (const [id, collider] of $<Collider<unknown>>("collider")!.entries()) {
const position = $<Vector>("position")!.get(id);
}
}