Jump to content

prototype sprite.tint


espace
 Share

Recommended Posts

Hi,

My prototype below works but i want to have an option to choose if yes or no i put a tint color.

So if tint = "none" my sprite have no tint if i put an another color like 0xFFFFFF then my sprite have this tint color.

How do you that ?

Thanks

 

e = function (game,nameA,posx,posy,width,height,anchor,tint,alpha) {

	Phaser.Sprite.call(this,game,posx,posy,nameA)
	this.x=posx;
	this.y=posy;
	this.width=width;
	this.height=height;
	this.anchor.set(anchor);
	this.tint=function(tint) {
		if ( tint == "none" ) {
			tint=null;
		} else {
		tint=tint;
		}		
		return tint;
	}
	this.alpha=alpha;;

	game.add.existing(this);
}

e.prototype = Object.create(Phaser.Sprite.prototype);
e.prototype.constructor = e;


var example = new e(this.game,'rect',100,100,90,90,.5,"none",1)


 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...