UVShiftingAndAlphaClamp
From GameStudio Wiki
This code take the alpha entSkin1 and uses it (still in place) to "cut out" the base texture. If you dont shift the texture, it looks normal, but when you shift the base texture, only the RGB values are moving, the alpha stays and clamps the base texture.
this is how it looks like:
and this is the code:
function mtl_UV_alphaClamp_event ();
material mtl_UV_alphaClamp {
event = mtl_UV_alphaClamp_event;
effect = "
matrix matMtl;
extern texture entSkin1;
technique uvspeed
{
pass p0
{
Texture[0] = <entSkin1>;
ColorOp[0] = Subtract;
Texture[1] = <entSkin1>;
ColorOp[1] = SelectArg1;
TextureTransform[1] = <matMtl>;
TextureTransformFlags[1] = Count2;
}
}";
}
function mtl_UV_alphaClamp_event ()
{
mat_identity(mtl.matrix);
mtl.ENABLE_RENDER = on;
mtl.matrix31 = floatd(my.skill1, 256);
mtl.matrix32 = floatd(my.skill2, 256);
}
action bla ()
{
my.material = mtl_UV_alphaClamp;
while (1) {
my.skill1 += 5 * time_step;
my.skill2 += 2 * time_step;
wait(1);
}
}
Just c&p it into your code and assign mtl_UV_alphaClamp as material. With skill1 and skill2 you are able to shift the texture. You could also define them befor again as u and v (define u = skill98; define v = skill99;) - you just have to change that in mtl_UV_alphaClamp_event and your own function.
by HeelX
