azerion / phaser-spine

A plugin for Phaser 2 that adds Spine support
MIT License
121 stars 58 forks source link

how to change the tint of spine object? #81

Closed TinyDobbins closed 6 years ago

TinyDobbins commented 7 years ago

does anyone know how to change the tint color of spine object?

I tried also change the each slot manually: hero.skeleton.findSlot('head').currentSprite.tint = 0xFF0000

nothing happens :(

shibekin69 commented 7 years ago

Try the property color.r, color.g, color.b.

TinyDobbins commented 7 years ago

@shibekin69 I can't find this property in spine object.

spine.setTint() also don't work.

shibekin69 commented 7 years ago

Maybe it's in the bone?

shibekin69 commented 7 years ago

Ok, scratch that. Try adjusting these:

spineObj.skeleton.findSlot('head').r = 1   // red, 0 to 1
spineObj.skeleton.findSlot('head').g = 1  // green, 0 to 1
spineObj.skeleton.findSlot('head').b = 1  // blue, 0 to 1
spineObj.skeleton.findSlot('head').a = 1  // alpha, 0 to 1

I think you set it with a hex value like 0x000000 to 0x0000ff. I'm not sure.

TinyDobbins commented 7 years ago

fixed #82 just need to add if(slot.currentSprite)