Professional help needed: regions!

Started by InCreator, Mon 01/09/2003 02:38:05

Previous topic - Next topic

InCreator

 :( How do I *ANIMATE* regions to make their RGB values to change after every - let's say - 30 steps?
(Point is to simulate disco lights, regions for AGS itself and animated 3-d background for overall beauty).

I know there's a deal with SetRegionTint (or some thing like that) and timers(I guess).

Anyone care to give me a simple code?   :-\

cornjob

First you make a repeatedly_execute function in the room. (the room script not the global script)

Then you basically increment a counter every game turn... it will vary depending on how you want the colors to cycle, but here's one example to cycle between red and blue every second:

inside rep_exe:

counter++;

if (counter==40) [40 cycles equals a second]
{
SetRegionTint(... [set the region's tint to red]
}

if (counter==80)
{
SetRegionTint(... [set the region's tint to blue]
counter=0;
}

So anyway, hopefully you get the idea. Don't forget to initialize the counter to 0. (at the top of the room script)

InCreator

Aha! So variable counter is used and counter++ means it has relative value of +1 every step.
Well, thanks! Sound very logical and -- simple.
I messed with timers till I was even more confused and so easy piece of script did it all! (this is what separates programmers from other crowd - finding easiest solutions - I think :D)

SMF spam blocked by CleanTalk