new Trail(game, trailLength, color)
Creates a new Juicy.Trail
object.
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
game |
Phaser.Game | Current game instance. |
||
trailLength |
number |
<optional> |
100 | The length of the trail |
color |
number |
<optional> |
0xFFFFFF | The color of the trail |
- Source - out/plugins/Juicy/Juicy.js, line 116
Members
-
target :Phaser.Sprite
-
The target sprite whose movement we want to create the trail from
- Source - out/plugins/Juicy/Juicy.js, line 122
-
trailColor :Phaser.Sprite
-
The color of the trail
- Source - out/plugins/Juicy/Juicy.js, line 140
-
trailLength :number
-
The number of segments to use to create the trail
- Source - out/plugins/Juicy/Juicy.js, line 126
-
trailScaling
-
- Source - out/plugins/Juicy/Juicy.js, line 135
Properties:
Name Type Description trailScale
boolean Whether or not to taper the trail towards the end
-
trailWidth :number
-
The width of the trail
- Source - out/plugins/Juicy/Juicy.js, line 130
Methods
-
addSegment(x, y)
-
Adds a segment to the segments list and culls the list if it is too long
Parameters:
Name Type Argument Description x
number <optional>
The x position of the point
y
number <optional>
The y position of the point
- Source - out/plugins/Juicy/Juicy.js, line 179
-
redrawSegments(offsetX, offsetY)
-
Creates and draws the triangle trail from segments
Parameters:
Name Type Argument Description offsetX
number <optional>
The x position of the object
offsetY
number <optional>
The y position of the object
- Source - out/plugins/Juicy/Juicy.js, line 205
-
update()
-
Updates the Trail if a target is set
- Source - out/plugins/Juicy/Juicy.js, line 163