Namespace: Flip

Phaser.GameObjects.Components. Flip

Provides methods used for visually flipping a Game Object. Should be applied as a mixin and not used directly.

Since: 3.0.0
Source: src/gameobjects/components/Flip.js (Line 7)

Members


flipX :boolean

The horizontally flipped state of the Game Object.

A Game Object that is flipped horizontally will render inversed on the horizontal axis. Flipping always takes place from the middle of the texture and does not impact the scale value. If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.

Type:
  • boolean
Since: 3.0.0
Default Value:
  • false
Source: src/gameobjects/components/Flip.js (Line 17)

flipY :boolean

The vertically flipped state of the Game Object.

A Game Object that is flipped vertically will render inversed on the vertical axis (i.e. upside down) Flipping always takes place from the middle of the texture and does not impact the scale value. If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.

Type:
  • boolean
Since: 3.0.0
Default Value:
  • false
Source: src/gameobjects/components/Flip.js (Line 31)

Methods


resetFlip()

Resets the horizontal and vertical flipped state of this Game Object back to their default un-flipped state.

Since: 3.0.0
Source: src/gameobjects/components/Flip.js (Line 140)
Returns:

This Game Object instance.

Type
Phaser.GameObjects.Components.Flip

setFlip(x, y)

Sets the horizontal and vertical flipped state of this Game Object.

A Game Object that is flipped will render inversed on the flipped axis. Flipping always takes place from the middle of the texture and does not impact the scale value. If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.

Parameters:
Name Type Description
x boolean

The horizontal flipped state. false for no flip, or true to be flipped.

y boolean

The horizontal flipped state. false for no flip, or true to be flipped.

Since: 3.0.0
Source: src/gameobjects/components/Flip.js (Line 117)
Returns:

This Game Object instance.

Type
Phaser.GameObjects.Components.Flip

setFlipX(value)

Sets the horizontal flipped state of this Game Object.

A Game Object that is flipped horizontally will render inversed on the horizontal axis. Flipping always takes place from the middle of the texture and does not impact the scale value. If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.

Parameters:
Name Type Description
value boolean

The flipped state. false for no flip, or true to be flipped.

Since: 3.0.0
Source: src/gameobjects/components/Flip.js (Line 79)
Returns:

This Game Object instance.

Type
Phaser.GameObjects.Components.Flip

setFlipY(value)

Sets the vertical flipped state of this Game Object.

Parameters:
Name Type Description
value boolean

The flipped state. false for no flip, or true to be flipped.

Since: 3.0.0
Source: src/gameobjects/components/Flip.js (Line 100)
Returns:

This Game Object instance.

Type
Phaser.GameObjects.Components.Flip

toggleFlipX()

Toggles the horizontal flipped state of this Game Object.

A Game Object that is flipped horizontally will render inversed on the horizontal axis. Flipping always takes place from the middle of the texture and does not impact the scale value. If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.

Since: 3.0.0
Source: src/gameobjects/components/Flip.js (Line 45)
Returns:

This Game Object instance.

Type
Phaser.GameObjects.Components.Flip

toggleFlipY()

Toggles the vertical flipped state of this Game Object.

Since: 3.0.0
Source: src/gameobjects/components/Flip.js (Line 64)
Returns:

This Game Object instance.

Type
Phaser.GameObjects.Components.Flip