From 512072688ac1a87ed87e05eacf5bf33325ec3e7d Mon Sep 17 00:00:00 2001 From: Schluffe Date: Mon, 30 Mar 2026 23:25:25 +0200 Subject: [PATCH] WIP --- engine/system/physics.ts | 13 ++----------- game/entities/hero/entity.ts | 14 ++------------ 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/engine/system/physics.ts b/engine/system/physics.ts index 41d13ba..ef829b0 100644 --- a/engine/system/physics.ts +++ b/engine/system/physics.ts @@ -1,17 +1,8 @@ import type { Circle } from "#/engine/Circle.ts"; import type { Polygon } from "#/engine/Polygon.ts"; -import { createRect, fillRect, type Rect, strokeRect } from "#/engine/Rect.ts"; +import { createRect, type Rect } from "#/engine/Rect.ts"; import $ from "#/engine/Scene.ts"; -import { - createVector, - getDistance, - getDotProduct, - invScale, - scale, - setUnitNormal, - type Vector, -} from "#/engine/Vector.ts"; -import { viewport } from "#/engine/Viewport.ts"; +import { createVector, getDotProduct, type Vector } from "#/engine/Vector.ts"; export enum Shape { Cirle, diff --git a/game/entities/hero/entity.ts b/game/entities/hero/entity.ts index c90c524..7a2bb18 100644 --- a/game/entities/hero/entity.ts +++ b/game/entities/hero/entity.ts @@ -1,7 +1,7 @@ import { defineEntity } from "#/engine/Entity.ts"; import { keyboardInput } from "#/engine/Keyboard.ts"; import { pointer } from "#/engine/Pointer.ts"; -import { createRect, fillRect, strokeRect } from "#/engine/Rect.ts"; +import { createRect } from "#/engine/Rect.ts"; import $ from "#/engine/Scene.ts"; import { createSprite, @@ -9,7 +9,6 @@ import { defineSpriteSheet, } from "#/engine/Sprite.ts"; import { - type Collider, createCollider, moveAndSlide, Shape, @@ -20,7 +19,6 @@ import { scale, type Vector, } from "#/engine/Vector.ts"; -import { viewport } from "#/engine/Viewport.ts"; import charIdle from "#/game/assets/char-idle.png"; const speed = 0.1; @@ -35,12 +33,7 @@ const process = defineEntity("hero", { }); process((id, delta) => { - const positions = $("position"); - const position = positions.get(id)!.value; - - const colliders = $("collider"); - const collider = colliders.get(id)!.value; - + const position = $("position").get(id)!.value; const velocity = $("velocity").get(id)!.value; if (pointer.isDown) { @@ -63,7 +56,4 @@ process((id, delta) => { velocity.x = 0; velocity.y = 0; - - fillRect(viewport.ctx, collider.aabb, "orange"); - strokeRect(viewport.ctx, collider.aabb, "red"); });