This commit is contained in:
Schluffe
2026-03-30 23:25:25 +02:00
parent bc9bdc3624
commit 512072688a
2 changed files with 4 additions and 23 deletions
+2 -11
View File
@@ -1,17 +1,8 @@
import type { Circle } from "#/engine/Circle.ts"; import type { Circle } from "#/engine/Circle.ts";
import type { Polygon } from "#/engine/Polygon.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 $ from "#/engine/Scene.ts";
import { import { createVector, getDotProduct, type Vector } from "#/engine/Vector.ts";
createVector,
getDistance,
getDotProduct,
invScale,
scale,
setUnitNormal,
type Vector,
} from "#/engine/Vector.ts";
import { viewport } from "#/engine/Viewport.ts";
export enum Shape { export enum Shape {
Cirle, Cirle,
+2 -12
View File
@@ -1,7 +1,7 @@
import { defineEntity } from "#/engine/Entity.ts"; import { defineEntity } from "#/engine/Entity.ts";
import { keyboardInput } from "#/engine/Keyboard.ts"; import { keyboardInput } from "#/engine/Keyboard.ts";
import { pointer } from "#/engine/Pointer.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 $ from "#/engine/Scene.ts";
import { import {
createSprite, createSprite,
@@ -9,7 +9,6 @@ import {
defineSpriteSheet, defineSpriteSheet,
} from "#/engine/Sprite.ts"; } from "#/engine/Sprite.ts";
import { import {
type Collider,
createCollider, createCollider,
moveAndSlide, moveAndSlide,
Shape, Shape,
@@ -20,7 +19,6 @@ import {
scale, scale,
type Vector, type Vector,
} from "#/engine/Vector.ts"; } from "#/engine/Vector.ts";
import { viewport } from "#/engine/Viewport.ts";
import charIdle from "#/game/assets/char-idle.png"; import charIdle from "#/game/assets/char-idle.png";
const speed = 0.1; const speed = 0.1;
@@ -35,12 +33,7 @@ const process = defineEntity("hero", {
}); });
process((id, delta) => { process((id, delta) => {
const positions = $<Vector>("position"); const position = $<Vector>("position").get(id)!.value;
const position = positions.get(id)!.value;
const colliders = $<Collider>("collider");
const collider = colliders.get(id)!.value;
const velocity = $<Vector>("velocity").get(id)!.value; const velocity = $<Vector>("velocity").get(id)!.value;
if (pointer.isDown) { if (pointer.isDown) {
@@ -63,7 +56,4 @@ process((id, delta) => {
velocity.x = 0; velocity.x = 0;
velocity.y = 0; velocity.y = 0;
fillRect(viewport.ctx, collider.aabb, "orange");
strokeRect(viewport.ctx, collider.aabb, "red");
}); });