From 1e24a5471f0cd5db26f1f45114841e3512d6d994 Mon Sep 17 00:00:00 2001 From: Gnlow Date: Wed, 6 Dec 2023 11:15:58 +0900 Subject: [PATCH] impl: move_to_angle --- src/Entry.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Entry.ts b/src/Entry.ts index af9c55d..e06ee75 100644 --- a/src/Entry.ts +++ b/src/Entry.ts @@ -273,6 +273,10 @@ export class Entry { const dy = target.y - obj.y obj.angle = toDegrees(dy / dx) - obj.direction + (dx > 0 ? 90 : 270) } + move_to_angle(angle: number, n: number, obj: EntrySprite) { + obj.x += n * Math.sin(toRadian(angle)) + obj.y -= n * Math.cos(toRadian(angle)) + } /* μƒκΉ€μƒˆ */ show(obj: EntrySprite) {