Damon Caskey said:
Kratus said:pepodmc
This "cycleSprite" script is a custom version I'm using for SOR2X, I didn't see this delay before because I'm only using it for simple and small animations only.
I will check the script to see what's causing the delay, but for large and complex animations maybe it's better using entities instead.
msmalik681 said:Great tutorial but i would much rather use a panel entity. Using a 24bit png sounds amazing how does transparency work with high colour images ?
void cycleSprite(void type, int startIndex, int endIndex, float frameDelay, float cycleDelay)
{//Apply simple sprite cycle effects to avoid creating new entities
float timeCurrent = openborvariant("elapsed_time");
float timeCounter = getlocalvar("timeCounter"+type+startIndex);
int levelCurrent = openborvariant("current_level");
int levelPrevious = getlocalvar("levelPrevious");
int frameCurrent = getlocalvar("frameCurrent"+type+startIndex);
int frameNext = getlocalvar("frameNext"+type+startIndex);
int frameStart = getlocalvar("frameStart"+type+startIndex);
//CLEAR ALL LOCAL VARIABLES WHEN THE LEVEL CHANGES
if(levelCurrent != levelPrevious){clearlocalvar();setlocalvar("levelPrevious", levelCurrent);}
//START ALL VARIABLES
if(timeCounter == NULL()){setlocalvar("timeCounter"+type+startIndex, timeCurrent+frameDelay);}
if(frameCurrent == NULL()){setlocalvar("frameCurrent"+type+startIndex, endIndex);}
if(frameNext == NULL()){setlocalvar("frameNext"+type+startIndex, startIndex);}
if(frameStart == NULL()){setlocalvar("frameStart"+type+startIndex, startIndex);}
//DISABLE ALL LAYERS EXCEPT FOR THE LAST, WHEN THE SCRIPT STARTS
while(frameStart < endIndex-1){
frameStart = getlocalvar("frameStart"+type+startIndex);
changelayerproperty(type, frameStart, "enabled", 0);
setlocalvar("frameStart"+type+startIndex, frameStart+1);
}
//EXECUTE ALL TASKS
if(getglobalvar("activeText") == 0 || getglobalvar("activeText") == NULL()){
//DELAY REACHED THE LIMIT?? EXECUTE ALL TASKS
if(timeCurrent > timeCounter){
//DEFINE THE CURRENT FRAME
if(frameCurrent < endIndex){
setlocalvar("frameCurrent"+type+startIndex, frameCurrent+1);
setlocalvar("timeCounter"+type+startIndex, timeCurrent+frameDelay);
}
else
{
if(cycleDelay != NULL()){setlocalvar("timeCounter"+type+startIndex, timeCurrent+frameDelay+cycleDelay);}
setlocalvar("frameCurrent"+type+startIndex, startIndex);
}
//DEFINE THE NEXT FRAME
if(frameNext < endIndex){
setlocalvar("frameNext"+type+startIndex, frameNext+1);
setlocalvar("timeCounter"+type+startIndex, timeCurrent+frameDelay);
}
else
{
if(cycleDelay != NULL()){setlocalvar("timeCounter"+type+startIndex, timeCurrent+frameDelay+cycleDelay);}
setlocalvar("frameNext"+type+startIndex, startIndex);
}
//CHANGE LAYERS
changelayerproperty(type, frameCurrent, "enabled", 0);
changelayerproperty(type, frameNext, "enabled", 1);
}
}
}
Kratus said:pepodmc
In fact DC is right, I'm not clearing the variables properly in the "cycleSprite" script. Thanks Damon Caskey
Yeah, I'm using it on the SOR2X v2.3 in some levels. Below is an example of the "fglayer" properties.Its possible to add the quake effect to the sprites using this cycle sprite method?
##BGLAYER PROPERTIES
#filepath xratio zratio xoffset zoffset xspace zspace xrepeat zrepeat transp alpha w-mode amp wl ws move quake neon
#FGLAYER PROPERTIES
#filepath zpos xratio zratio xoffset zoffset xspace zspace xrepeat zrepeat transp alpha w-mode amp wl ws move quake neon
Kratus said:pepodmc
Yeah, I'm using it on the SOR2X v2.3 in some levels. Below is an example of the "fglayer" properties.Its possible to add the quake effect to the sprites using this cycle sprite method?
Code:##BGLAYER PROPERTIES #filepath xratio zratio xoffset zoffset xspace zspace xrepeat zrepeat transp alpha w-mode amp wl ws move quake neon #FGLAYER PROPERTIES #filepath zpos xratio zratio xoffset zoffset xspace zspace xrepeat zrepeat transp alpha w-mode amp wl ws move quake neon