paulo.bender
Member
Greetings, fellow developers!
I'm currently working on a Sonic fangame, and I'd like to share my newest script; a palette cycling effect, useful for many things (the most important of them, at least for me, is shown on the video below). This is my first attempt on doing my own ondrawscript, and I would like some feedback on it, and also a little help.
I'm currently using mod (%) to control the palette change interval, but greater number (i.e.: 10) make the script behave weirdly, locking the character in a single, random palette for too long.
Here's the script code:
To use it, open your character's ondrawscript and import this script. Inside main(), call LoopPal with the needed parameters.
There are two videos showing the script in action:
I'm currently working on a Sonic fangame, and I'd like to share my newest script; a palette cycling effect, useful for many things (the most important of them, at least for me, is shown on the video below). This is my first attempt on doing my own ondrawscript, and I would like some feedback on it, and also a little help.
I'm currently using mod (%) to control the palette change interval, but greater number (i.e.: 10) make the script behave weirdly, locking the character in a single, random palette for too long.
Here's the script code:
Code:
void LoopPal(void LastMap, void LoopInterval)
{
void self = getlocalvar("self"); //get caller
void selfMap = getentityproperty(self, "map");
void Alive = getentityproperty(self, "exists");
void gametime = openborvariant("elapsed_time");
void NewMap;
void CheckInterval = (gametime % LoopInterval);
//-----------------------------------------------------
if(openborvariant("in_level"))
{
// settextobj(12,4,4,1, 170, gametime);
// settextobj(13,4,16,1, 170, CheckInterval);
// settextobj(14,4,28,1, 170, selfMap);
if (CheckInterval == 0)
{
if (selfMap == LastMap) {NewMap = 0;}
else {NewMap = (selfMap +1);}
changeentityproperty(self, "map", NewMap);
}
}
}
To use it, open your character's ondrawscript and import this script. Inside main(), call LoopPal with the needed parameters.
There are two videos showing the script in action: