Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Alen101 on Thu 17/12/2015 04:50:14

Title: Tint animation
Post by: Alen101 on Thu 17/12/2015 04:50:14
Is there a way to animate tint?
I have a character in front of a big tv so it would be cool to have this character with a tint rotation on it.

I have found this, preety cool but it wont work with tint.
Transparency = Random(50);
Title: Re: Tint animation
Post by: Mandle on Thu 17/12/2015 05:22:20
Just set variables as random numbers and use those variables in the tint command instead of numbers, and put the code in repeatedly execute.
Title: Re: Tint animation
Post by: Gilbert on Thu 17/12/2015 05:25:47
Quote from: Alen101 on Thu 17/12/2015 04:50:14
but it wont work with tint.

Yeah, it would work, depending what you really want:
Code (ags) Select
cEgo.Tint(Random(255), Random(255), Random(255), 100, 100);

Title: Re: Tint animation
Post by: Alen101 on Thu 17/12/2015 05:44:57
Thank you guys!
This is working fine, just to know, theres a way to delay a little bit the blinking?
Title: Re: Tint animation
Post by: Scavenger on Thu 17/12/2015 06:24:53
Like this:
Code (AGS) Select

//Put these at the top of the script in question.
int counter=0;
int delay=5; //or however many game loops you want to wait for.

function repeatedly_execute () //or wherever you put the code.
{
    if (counter > delay)
    {
        cEgo.Tint(Random(255), Random(255), Random(255), 100, 100);
        counter=0;
    }
    else counter++;
}
Title: Re: Tint animation
Post by: Alen101 on Thu 17/12/2015 13:47:03
Thank you very much Scavenger this works perfectly!!!
Title: Re: Tint animation
Post by: Alen101 on Thu 17/12/2015 14:44:14
just one more little question and i promess to leave the subject alone,
how can i use this but just when the player steps on a region?

I have tryed but i cant figure it out, because the random with delay only works on rep exec and region stuff cant go inside the rep exec function since is a function and function inside a function is wrong.

Title: Re: Tint animation
Post by: Khris on Fri 18/12/2015 11:15:11
In line 9 of the snippet, put   if (Region.GetAtRoomXY(cEgo.x, cEgo.y) == region[1]) before the cEgo.Tint() command.
Then add a steps off region 1 event and in there, reset the tint.
Title: Re: Tint animation
Post by: Alen101 on Fri 18/12/2015 15:50:30
Thank you Khris you are the best
Works fine