Tint animation

Started by Alen101, Thu 17/12/2015 04:50:14

Previous topic - Next topic

Alen101

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);

Mandle

Just set variables as random numbers and use those variables in the tint command instead of numbers, and put the code in repeatedly execute.

Gilbert

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
cEgo.Tint(Random(255), Random(255), Random(255), 100, 100);



Alen101

Thank you guys!
This is working fine, just to know, theres a way to delay a little bit the blinking?

Scavenger

Like this:
Code: AGS

//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++;
}

Alen101

Thank you very much Scavenger this works perfectly!!!

Alen101

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.


Khris

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.

Alen101

Thank you Khris you are the best
Works fine

SMF spam blocked by CleanTalk