add enemy ia
This commit is contained in:
parent
55a5adcd92
commit
328d508ae7
2 changed files with 47 additions and 0 deletions
|
@ -224,6 +224,14 @@ export class Vec2 {
|
|||
public clone() {
|
||||
return new Vec2(this.x(), this.y());
|
||||
}
|
||||
|
||||
public normalize() {
|
||||
return new Vec2(clamp(this.x(), -1, 1), clamp(this.y(), -1, 1));
|
||||
}
|
||||
}
|
||||
|
||||
export function clamp(x: number, min: number, max: number) {
|
||||
return Math.max(min, Math.min(x, max));
|
||||
}
|
||||
|
||||
export function v2(x: number, y: number) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue