Navigation
These archived docs are for Phaser 2.2.2 Phaser 3 docs can be found on newdocs.phaser.io.
Phaser CE docs can be found on the Phaser CE Documentation site.

Constructor

PIXI. Rectangle

new Rectangle(x, y, width, height)

the Rectangle object is an area defined by its position, as indicated by its top-left corner point (x, y) and by its width and its height.

Parameters
Name Type Description
x Number

The X coordinate of the upper-left corner of the rectangle

y Number

The Y coordinate of the upper-left corner of the rectangle

width Number

The overall width of this rectangle

height Number

The overall height of this rectangle

Source code: pixi/geom/Rectangle.js, line 5

Public Properties

height : number

Default Value
  • 0
Source code: pixi/geom/Rectangle.js, line 38

type : number

The type of the object, should be one of the Graphics type consts, PIXI.Graphics.RECT in this case

Default Value
  • 0
Source code: pixi/geom/Rectangle.js, line 45

width : number

Default Value
  • 0
Source code: pixi/geom/Rectangle.js, line 31

x : number

Default Value
  • 0
Source code: pixi/geom/Rectangle.js, line 17

y : number

Default Value
  • 0
Source code: pixi/geom/Rectangle.js, line 24

Public Methods

clone() → {PIXI.Rectangle}

Creates a clone of this Rectangle

Returns

a copy of the rectangle

Source code: pixi/geom/Rectangle.js, line 53

contains(x, y) → {Boolean}

Checks whether the x and y coordinates given are contained within this Rectangle

Parameters
Name Type Description
x Number

The X coordinate of the point to test

y Number

The Y coordinate of the point to test

Returns
Boolean -

Whether the x/y coordinates are within this Rectangle

Source code: pixi/geom/Rectangle.js, line 64