Skip to content

Commit

Permalink
impl: move_to_angle
Browse files Browse the repository at this point in the history
  • Loading branch information
gnlow committed Dec 6, 2023
1 parent 6e03ae3 commit 1e24a54
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1e24a54

Please sign in to comment.