Table of Contents

Flashing an Object White

Useful for indicating hits on an object, for example in shoot-em-ups.

Assets

Code

orxObject_CreateFromConfig("Object");

Config

[Object]
Graphic         = Graphic
TrackList	= WhiteFlashTrack
 
[Graphic]
Texture       = ship.png
 
[WhiteShader]
ParamList = texture
Code = "
void main() {
 
    vec2 p = gl_TexCoord[0].xy;
    vec4 textureCol = texture2D(texture, p);
 
    gl_FragColor.r = 1.0;
    gl_FragColor.g = 1.0;
    gl_FragColor.b = 1.0;
    gl_FragColor.a = textureCol.a;
 
}"
 
[WhiteFlashTrack]
0.00 = Object.AddShader ^ WhiteShader
0.10 = Object.RemoveShader ^ WhiteShader
0.20 = Object.AddShader ^ WhiteShader
0.30 = Object.RemoveShader ^ WhiteShader
0.40 = Object.AddShader ^ WhiteShader
0.50 = Object.RemoveShader ^ WhiteShader

Result