I gave a try, not sure how well it works.
CoolAnimate.ash
Code: ags
CoolAnimate.asc
Code: ags
You use this module by just calling it in your character like
Code: ags
I assumed you needed this for a character, if it's for something else, you have to figure out something else
CoolAnimate.ash
Spoiler
import void CoolAnimate(this Character*, int view, int loop, int frame, int delay, BlockingStyle blockStyle);
[close]
CoolAnimate.asc
Spoiler
// new module script
managed struct CoolAnimateData{
bool animating;
int delay;
int count;
};
CoolAnimateData* coolData[];
void game_start(){
coolData = new CoolAnimateData[Game.CharacterCount];
for(int i=0; i<Game.CharacterCount; i++){
coolData[i] = new CoolAnimateData;
}
}
void repeatedly_execute_always(){
for(int i=0; i<Game.CharacterCount; i++){
if(coolData[i].animating){
if(coolData[i].count>coolData[i].delay){
coolData[i].count = 0;
int frame = character[i].Frame+1;
if(frame < Game.GetFrameCountForLoop(character[i].View, character[i].Loop)){
character[i].LockViewFrame(character[i].View, character[i].Loop, frame);
} else {
coolData[i].animating = false;
character[i].UnlockView(eKeepMoving);
}
} else {
coolData[i].count++;
}
}
}
}
void CoolAnimate(this Character*, int view, int loop, int frame, int delay, BlockingStyle blockStyle){
this.LockViewFrame(view, loop, frame);
coolData[this.ID].delay = delay;
coolData[this.ID].count = 0;
coolData[this.ID].animating = true;
if(blockStyle == eBlock){
int frame_count = Game.GetFrameCountForLoop(view, loop);
for (int i=0; i<frame_count; i++){
Wait(delay);
}
}
}
[close]
You use this module by just calling it in your character like
function hGlowingOrb_AnyClick() {
cEgo.CoolAnimate(VIEW1 /* view */, 2 /* loop */, 3 /* frame */, 5 /* delay */, eBlock);
}
I assumed you needed this for a character, if it's for something else, you have to figure out something else
