mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 22:18:29 +00:00
Merge pull request #4773 from rexrainbow/bob-tint
Add tint feature of bob
This commit is contained in:
commit
a993277b2f
2 changed files with 47 additions and 1 deletions
|
@ -94,7 +94,7 @@ var BlitterWebGLRenderer = function (renderer, src, interpolationPercentage, cam
|
|||
var tx1 = calcMatrix.getX(xw, yh);
|
||||
var ty1 = calcMatrix.getY(xw, yh);
|
||||
|
||||
var tint = Utils.getTintAppendFloatAlpha(0xffffff, bobAlpha);
|
||||
var tint = Utils.getTintAppendFloatAlpha(bob.tint, bobAlpha);
|
||||
|
||||
// Bind texture only if the Texture Source is different from before
|
||||
if (frame.sourceIndex !== prevTextureSourceIndex)
|
||||
|
|
|
@ -88,6 +88,16 @@ var Bob = new Class({
|
|||
*/
|
||||
this.data = {};
|
||||
|
||||
/**
|
||||
* The tint value of this Bob.
|
||||
*
|
||||
* @name Phaser.GameObjects.Bob#tint
|
||||
* @type {number}
|
||||
* @default 0xffffff
|
||||
* @since 3.20.0
|
||||
*/
|
||||
this.tint = 0xffffff;
|
||||
|
||||
/**
|
||||
* The visible state of this Bob.
|
||||
*
|
||||
|
@ -215,6 +225,25 @@ var Bob = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Changes the position of this Bob to the values given.
|
||||
*
|
||||
* @method Phaser.GameObjects.Bob#setPosition
|
||||
* @since 3.20.0
|
||||
*
|
||||
* @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object.
|
||||
* @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object.
|
||||
*
|
||||
* @return {Phaser.GameObjects.Bob} This Bob Game Object.
|
||||
*/
|
||||
setPosition: function (x, y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the horizontal flipped state of this Bob.
|
||||
*
|
||||
|
@ -307,6 +336,23 @@ var Bob = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the tint of this Bob.
|
||||
*
|
||||
* @method Phaser.GameObjects.Bob#setTint
|
||||
* @since 3.20.0
|
||||
*
|
||||
* @param {number} value - The tint value used for this Bob. Between 0 and 0xffffff.
|
||||
*
|
||||
* @return {Phaser.GameObjects.Bob} This Bob Game Object.
|
||||
*/
|
||||
setTint: function (value)
|
||||
{
|
||||
this.tint = value;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroys this Bob instance.
|
||||
* Removes itself from the Blitter and clears the parent, frame and data properties.
|
||||
|
|
Loading…
Add table
Reference in a new issue