Ok, so sometimes you shouldn't believe everything you read.
For example, in the Gideros instructions it says that the setColorTransform command takes parameters from the value 0 to 1. That's kinda not true.
But, it's a useful 'not true' as it means you can add a nice effect used in arcade games for when a sprite gets hit. In an arcade game they usually flash white.
Normally you would have to have a white 'mask' of the sprite or do some fancy shader coding, but in reality you don't because the setColorTransform limit is actually not 1...
Here is my game sprite:
Here is code that has a much higher than 'valid' value for the setColorTransform...
Want to make it red instead? ...
So, it's that easy! After a frame just set the transform back to normal (1,1,1) and the original colours will be restored.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
https://deluxepixel.com
Comments
Likes: theone10
https://deluxepixel.com
Likes: theone10, bgcis
(everything I've tried)
https://deluxepixel.com
I have one similar question: how to fill whole sprite with definite RGB or hex color?
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
if my temp_sprite is 100% white, I can fill it with colors:
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Fragmenter - animated loop machine and IKONOMIKON - the memory game
If sprite is white, this code works:
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
http://forum.giderosmobile.com/discussion/6742/2016-10-sprite-setblendmode-src-dst
http://docs.giderosmobile.com/reference/gideros/Sprite/setBlendMode#Sprite:setBlendMode
http://wiki.giderosmobile.com/index.php/Sprite:setBlendMode
But either I am stupid or it's not documented enough for noobs like me, I've no idea how to do even simple stuff, how to actually use them blendmodes and rendertarget.
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
It seems that most of the values do not work, the wiki page seems very outdated?
The only values I could get are:
Likes: Apollo14
A custom shader would do the job easily, as @keszegh suggested.
Likes: Apollo14
At my level I would have gone the render target way but it may be slow for what you are doing!
BTW I had a last try you can experiment with:
a) Fill your target area with the color you want your sprite to be in
b) draw your sprite with blending factors ZERO for source and SRC_ALPHA for destination
I didn't try but in theory that should work
Likes: Apollo14
Likes: MoKaLux, Apollo14, talis
Likes: Apollo14
I'll try to understand it after morning meditation when my mind is fresh
Likes: MoKaLux
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)