Phaser API Documentation

  Version: 
setColors([colors])

Description:

Set the color values used by the Rope during rendering.

Colors are used to control the level of tint applied across the Rope texture.

You can provide the values in a number of ways:

  • One single numeric value: setColors(0xff0000) - This will set a single color tint for the whole Rope.
  • An array of values: setColors([ 0xff0000, 0x00ff00, 0x0000ff ])

If you provide an array of values and the array has exactly the same number of values as points in the Rope, it will use each color per rope segment.

If the provided array has a different number of values than points then it will use the values in order, from the first Rope segment and on, until it runs out of values. This allows you to control the color values at all vertices in the Rope.

Parameters:

name type arguments description
colors number | Array.<number> <optional>

Either a single color value, or an array of values. If nothing is provided color is reset to 0xffffff.

Returns:
Description:

This Game Object instance.

Since: 3.23.0