Skip to content

Commit

Permalink
impl: distance_something
Browse files Browse the repository at this point in the history
  • Loading branch information
gnlow committed Dec 29, 2023
1 parent fb8305d commit 58eb7ce
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,19 @@ export class Entry {
return new Date().getSeconds()
}
}
distance_something(targetId: string, obj: EntryContainer) {
let target: { x: number, y: number }
if (targetId == "mouse") {
target = this.mouse
} else {
target = this.objects[targetId]
}
const dx = target.x - obj.x
const dy = target.y - obj.y
return Math.sqrt(
dx**2 + dy**2
)
}
length_of_string(str: string) {
return str.length
}
Expand Down

0 comments on commit 58eb7ce

Please sign in to comment.