You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
421 B
25 lines
421 B
class Vector extends p5.Vector {
|
|
|
|
x: number
|
|
y: number
|
|
|
|
constructor(x: number, y: number){
|
|
super(x, y);
|
|
}
|
|
|
|
addMag(length: number): Vector{
|
|
this.setMag(this.mag() + length)
|
|
return this
|
|
}
|
|
|
|
serialized(): Serialized.Vector{
|
|
return {
|
|
x: this.x,
|
|
y: this.y
|
|
};
|
|
}
|
|
|
|
copy(): Vector{
|
|
return new Vector(this.x, this.y)
|
|
}
|
|
} |