new Point(x, y)
Creates a new Point. If you pass no parameters a Point is created set to (0,0).
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The horizontal position of this Point (default 0) |
y |
number | The vertical position of this Point (default 0) |
- Source:
Members
-
x
-
- Source:
Properties:
Name Type Description x
number The x coordinate of the point.
-
y
-
- Source:
Properties:
Name Type Description y
number The y coordinate of the point.
Methods
-
<static> add(a, b, out) → {Phaser.Point}
-
Adds the coordinates of two points together to create a new point.
Parameters:
Name Type Argument Description a
Phaser.Point The first Point object.
b
Phaser.Point The second Point object.
out
Phaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
<static> distance(a, b, round) → {number}
-
Returns the distance of this Point object to the given object (can be a Circle, Point or anything with x/y properties).
Parameters:
Name Type Argument Description a
object The target object. Must have visible x and y properties that represent the center of the object.
b
object The target object. Must have visible x and y properties that represent the center of the object.
round
boolean <optional>
Round the distance to the nearest integer (default false).
- Source:
Returns:
The distance between this Point object and the destination Point object.
- Type
- number
-
<static> divide(a, b, out) → {Phaser.Point}
-
Divides the coordinates of two points to create a new point.
Parameters:
Name Type Argument Description a
Phaser.Point The first Point object.
b
Phaser.Point The second Point object.
out
Phaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
<static> equals(a, b) → {boolean}
-
Determines whether the two given Point objects are equal. They are considered equal if they have the same x and y values.
Parameters:
Name Type Description a
Phaser.Point The first Point object.
b
Phaser.Point The second Point object.
- Source:
Returns:
A value of true if the Points are equal, otherwise false.
- Type
- boolean
-
<static> multiply(a, b, out) → {Phaser.Point}
-
Multiplies the coordinates of two points to create a new point.
Parameters:
Name Type Argument Description a
Phaser.Point The first Point object.
b
Phaser.Point The second Point object.
out
Phaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
<static> rotate(a, x, y, angle, asDegrees, distance) → {Phaser.Point}
-
Rotates a Point around the x/y coordinates given to the desired angle.
Parameters:
Name Type Description a
Phaser.Point The Point object to rotate.
x
number The x coordinate of the anchor point
y
number The y coordinate of the anchor point
angle
number The angle in radians (unless asDegrees is true) to rotate the Point to.
asDegrees
boolean Is the given rotation in radians (false) or degrees (true)?
distance
number An optional distance constraint between the Point and the anchor.
- Source:
Returns:
The modified point object.
- Type
- Phaser.Point
-
<static> subtract(a, b, out) → {Phaser.Point}
-
Subtracts the coordinates of two points to create a new point.
Parameters:
Name Type Argument Description a
Phaser.Point The first Point object.
b
Phaser.Point The second Point object.
out
Phaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
add(x, y) → {Phaser.Point}
-
Adds the given x and y values to this Point.
Parameters:
Name Type Description x
number The value to add to Point.x.
y
number The value to add to Point.y.
- Source:
Returns:
This Point object. Useful for chaining method calls.
- Type
- Phaser.Point
-
clamp(min, max) → {Phaser.Point}
-
Clamps this Point object values to be between the given min and max.
Parameters:
Name Type Description min
number The minimum value to clamp this Point to.
max
number The maximum value to clamp this Point to.
- Source:
Returns:
This Point object.
- Type
- Phaser.Point
-
clampX(min, max) → {Phaser.Point}
-
Clamps the x value of this Point to be between the given min and max.
Parameters:
Name Type Description min
number The minimum value to clamp this Point to.
max
number The maximum value to clamp this Point to.
- Source:
Returns:
This Point object.
- Type
- Phaser.Point
-
clampY(min, max) → {Phaser.Point}
-
Clamps the y value of this Point to be between the given min and max
Parameters:
Name Type Description min
number The minimum value to clamp this Point to.
max
number The maximum value to clamp this Point to.
- Source:
Returns:
This Point object.
- Type
- Phaser.Point
-
clone(output) → {Phaser.Point}
-
Creates a copy of the given Point.
Parameters:
Name Type Argument Description output
Phaser.Point <optional>
Optional Point object. If given the values will be set into this object, otherwise a brand new Point object will be created and returned.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
copyFrom(source) → {Point}
-
Copies the x and y properties from any given object to this Point.
Parameters:
Name Type Description source
any The object to copy from.
- Source:
Returns:
This Point object.
- Type
- Point
-
copyTo(dest) → {Object}
-
Copies the x and y properties from this Point to any given object.
Parameters:
Name Type Description dest
any The object to copy to.
- Source:
Returns:
The dest object.
- Type
- Object
-
distance(dest, round) → {number}
-
Returns the distance of this Point object to the given object (can be a Circle, Point or anything with x/y properties)
Parameters:
Name Type Argument Description dest
object The target object. Must have visible x and y properties that represent the center of the object.
round
boolean <optional>
Round the distance to the nearest integer (default false).
- Source:
Returns:
The distance between this Point object and the destination Point object.
- Type
- number
-
divide(x, y) → {Phaser.Point}
-
Divides Point.x and Point.y by the given x and y values.
Parameters:
Name Type Description x
number The value to divide Point.x by.
y
number The value to divide Point.x by.
- Source:
Returns:
This Point object. Useful for chaining method calls.
- Type
- Phaser.Point
-
equals(a) → {boolean}
-
Determines whether the given objects x/y values are equal to this Point object.
Parameters:
Name Type Description a
Phaser.Point The first object to compare.
- Source:
Returns:
A value of true if the Points are equal, otherwise false.
- Type
- boolean
-
getMagnitude() → {number}
-
Calculates the length of the vector
- Source:
Returns:
the length of the vector
- Type
- number
-
invert() → {Point}
-
Inverts the x and y values of this Point
- Source:
Returns:
This Point object.
- Type
- Point
-
isZero() → {boolean}
-
Determine if this point is at 0,0
- Source:
Returns:
True if this Point is 0,0, otherwise false
- Type
- boolean
-
multiply(x, y) → {Phaser.Point}
-
Multiplies Point.x and Point.y by the given x and y values.
Parameters:
Name Type Description x
number The value to multiply Point.x by.
y
number The value to multiply Point.x by.
- Source:
Returns:
This Point object. Useful for chaining method calls.
- Type
- Phaser.Point
-
normalize() → {Phaser.Point}
-
Alters the vector so that its length is 1, but it retains the same direction
- Source:
Returns:
the modified original vector
- Type
- Phaser.Point
-
rotate(x, y, angle, asDegrees, distance) → {Phaser.Point}
-
Rotates this Point around the x/y coordinates given to the desired angle.
Parameters:
Name Type Argument Description x
number The x coordinate of the anchor point
y
number The y coordinate of the anchor point
angle
number The angle in radians (unless asDegrees is true) to rotate the Point to.
asDegrees
boolean Is the given rotation in radians (false) or degrees (true)?
distance
number <optional>
An optional distance constraint between the Point and the anchor.
- Source:
Returns:
The modified point object.
- Type
- Phaser.Point
-
set(x, y) → {Point}
-
Sets the x and y values of this Point object to the given coordinates.
Parameters:
Name Type Description x
number The horizontal position of this point.
y
number The vertical position of this point.
- Source:
Returns:
This Point object. Useful for chaining method calls.
- Type
- Point
-
setMagnitude(magnitude) → {Phaser.Point}
-
Alters the length of the vector without changing the direction
Parameters:
Name Type Description magnitude
number the desired magnitude of the resulting vector
- Source:
Returns:
the modified original vector
- Type
- Phaser.Point
-
setTo(x, y) → {Point}
-
Sets the x and y values of this Point object to the given coordinates.
Parameters:
Name Type Description x
number The horizontal position of this point.
y
number The vertical position of this point.
- Source:
Returns:
This Point object. Useful for chaining method calls.
- Type
- Point
-
subtract(x, y) → {Phaser.Point}
-
Subtracts the given x and y values from this Point.
Parameters:
Name Type Description x
number The value to subtract from Point.x.
y
number The value to subtract from Point.y.
- Source:
Returns:
This Point object. Useful for chaining method calls.
- Type
- Phaser.Point
-
toString() → {string}
-
Returns a string representation of this object.
- Source:
Returns:
A string representation of the instance.
- Type
- string