Sign in to follow this  
LinkTree

spriteTinter

Recommended Posts

Nice work dude! Does this work with Animated sprites and bitmap text as well?

EDIT: It seems like with Animation, the sprites flicker. Not working with text on my end so far.

But it's working great with normal sprite images!  :D

Share this post


Link to post
Share on other sites

Hi @LinkTree

 

I've been playing with the sprite tinter and for some reason, when I try to follow the instructions to set the 'tint' of my sprite, it just becomes invisible.

 

Not sure if I'm doing something wrong, but I can't seem to get it working :(

 

Thanks in advance!

Share this post


Link to post
Share on other sites

Hi @LinkTree

 

I've been playing with the sprite tinter and for some reason, when I try to follow the instructions to set the 'tint' of my sprite, it just becomes invisible.

 

Not sure if I'm doing something wrong, but I can't seem to get it working :(

 

Thanks in advance!

 

Ok I think I found the reason your textures were not showing. you are working with a tablet or a smartphone with high resolution I fixed this issue in the latest update. you can try it now.

Share this post


Link to post
Share on other sites

Hi @LinkTree

 

Thanks for the quick reply, but I still can't get it to work.

 

The only code I have is this ...

 

to require ...

 

.require(

    'plugins.spriteTinter',
 
and when creating the sprite ...
 
var lightSwitch = new game.LightSwitch(240, 212, this.bg);
lightSwitch.tint = "#FF0000";
 
The lightswitch works fine without the tint, but when when the tint is added, it becomes invisible.
 
Hope this helps :)

Share this post


Link to post
Share on other sites

 

Hi @LinkTree

 

Thanks for the quick reply, but I still can't get it to work.

 

The only code I have is this ...

 

to require ...

 

.require(

    'plugins.spriteTinter',
 
and when creating the sprite ...
 
var lightSwitch = new game.LightSwitch(240, 212, this.bg);
lightSwitch.tint = "#FF0000";
 
The lightswitch works fine without the tint, but when when the tint is added, it becomes invisible.
 
Hope this helps :)

 

 

is game.LightSwitch a class extended from game.Sprite?

Share this post


Link to post
Share on other sites

Hmmmm ... that could be it! It's extended from game.Animation

 

Any way to get it going with anims?

 

Thanks for spotting that!

 

Hmmm... I just tried it with a game.Animation and it worked fine. did you override the default rendering of game.Animation with game.LightSwitch?

 

this worked for me:

var anim = new game.Animation(['eye.png','eye2.png']);anim.play();anim.tint = "#ff0000";anim.addTo(game.scene.stage);

Edit:

I haven't seen your game.LightSwitch code but my assumption is that the problem might be in it's init function.

Share this post


Link to post
Share on other sites

This is all I have in my LightSwitch class ...

game.createClass('LightSwitch', 'Animation', {    textures: ['lightSwitch0001.png', 'lightSwitch0002.png', 'lightSwitchInvisible.png'],    interactive: true,    buttonMode: true,    init: function(x, y, container) {        this.anchor.set(this.width/2, 0);        this.position.set(x, y);        this.addTo(container);        this.off = true;    },});

and then to put in on screen ...

var lightSwitch = new game.LightSwitch(240, 212, this.bg);lightSwitch.tint = "#FF0000";

Hmmm ... I might very well be doing something wrong. I'll see if I can get it going haha.

 

Thank for your help :)

Share this post


Link to post
Share on other sites

This is all I have in my LightSwitch class ...

game.createClass('LightSwitch', 'Animation', {    textures: ['lightSwitch0001.png', 'lightSwitch0002.png', 'lightSwitchInvisible.png'],    interactive: true,    buttonMode: true,    init: function(x, y, container) {        this.anchor.set(this.width/2, 0);        this.position.set(x, y);        this.addTo(container);        this.off = true;    },});

and then to put in on screen ...

var lightSwitch = new game.LightSwitch(240, 212, this.bg);lightSwitch.tint = "#FF0000";

Hmmm ... I might very well be doing something wrong. I'll see if I can get it going haha.

 

Thank for your help :)

 

 

this worked for me:

game.createClass('Anim','Animation',{    textures: ['eye.png', 'eye2.png'],    interactive: true,    buttonMode: true,    init: function(x, y, container){        this.anchor.set(this.width/2, 0);        this.position.set(x, y);        this.addTo(container);        this.off = true;    }});var anim = new game.Anim(100,100,game.scene.stage);anim.tint = "#ff0000";anim.play();

Maybe it is something else that causes it. are you getting any errors in your console?

Share this post


Link to post
Share on other sites

Now that you say so ... I am. I completely forgot to check (as everything else was working).

 

[Error] TypeError: undefined is not an object (evaluating 'game.FastContainer.inject')

(anonymous function) (spriteTinter.js, line 334)
_loadModules (core.js, line 712)
_loadModules (core.js, line 720)
body (core.js, line 260)
global code (sprite.js, line 10)

Share this post


Link to post
Share on other sites

 

Now that you say so ... I am. I completely forgot to check (as everything else was working).

 

[Error] TypeError: undefined is not an object (evaluating 'game.FastContainer.inject')

(anonymous function) (spriteTinter.js, line 334)
_loadModules (core.js, line 712)
_loadModules (core.js, line 720)
body (core.js, line 260)
global code (sprite.js, line 10)

 

Are you using the 2.0 version? I am not sure but I think the first error is due to game.FastContainer not existing and it indeed doesn't exist in the 1.3 version.

Share this post


Link to post
Share on other sites

Yup definitely 2.0 :)

 

I think I'm using yesterdays update.

 

Hmmm... I just updated to the latest panda version and everything works. I am not sure what could be causing this...

 

can you please create a working example representing the issue?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.