Skip to content

Commit

Permalink
impl: see_angle_object
Browse files Browse the repository at this point in the history
  • Loading branch information
gnlow committed Dec 6, 2023
1 parent 3f7c127 commit 899fa85
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,16 @@ export class Entry {
direction_absolute(angle: number, obj: EntrySprite) {
obj.direction = angle
}
see_angle_object(objId: string, obj: EntrySprite) {
if (objId == "mouse")
throw new Error("Unimplemented: locate to mouse")
const target = this.objects[objId]
obj.rotation = Math.asin(
(target.y - obj.y)
/
(target.x - obj.x)
)
}

/* 생김새 */
show(obj: EntrySprite) {
Expand Down

0 comments on commit 899fa85

Please sign in to comment.