Skip to content

Instantly share code, notes, and snippets.

@ericoporto
Created September 26, 2019 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericoporto/cbe5e8b2f3444fe9371a4b24d640d925 to your computer and use it in GitHub Desktop.
Save ericoporto/cbe5e8b2f3444fe9371a4b24d640d925 to your computer and use it in GitHub Desktop.
CoolAnimate for Adventure Game Studio, Animate from any frame
// 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);
}
}
}
// new module header
import void CoolAnimate(this Character*, int view, int loop, int frame, int delay, BlockingStyle blockStyle);
@ericoporto
Copy link
Author

Use a Base64 decoder like this to get the below text as a zip file containing the module

UEsDBBQACAAIAPy5OU8AAAAAAAAAACIGAAAPACAAQ29vbEFuaW1hdGUuc2NtVVQNAAddH4xdsR+MXV0fjF11eAsAAQToAwAABOgDAAC9Vc2O2jAQTg+VKiTeYY7JJtqfc5ZKW1aLqnZP9OeAEPImE/A2iZFjoAhx3SfqY/R99lp7AomTgNReGgnJ9nwz830zY3M3Go8jyZfqUcSrFJ03Tvk9v3WcqyvIcQMZWaAgWL+XsZzNMYZCyVWkYChEepfzjCm8Z4rt+j2AJ30GjA55Pg/NEc8VxJiybbWLxCpXerfXv36vFeZCm0VqVpMp2deCxzBnGc4KxaRyPUp0BMGAmLaCTEYafzlcMMkihXJoEk4pfyKkazjwwXUI/PYETh/7fpmkTjPh09OZKOhea6moSlyiNsbpdoY/MVopnLF0w7bFgfk/MuCJa5G4rGrr7bSxhHRAVOD39gk14BiyJayEa3nXYW0vv3pvGCdSc9W46MjWOD+YQ/+mcrVcErf0uAUSOUJFYNL4IORnIZZuI9Y3jpugGd6APNJ6hhi08dEPE4Yy/VX0oNTlWeL3gGmBsGtkOdUEXYyEaWh4ls/XPD0wcvET4vJRrE3z7GTtynWzd5rl+2GNtpz3nWm0xtVVC15ANWoXATV1TVUxq5SKUTU6sK5uAB+MDM18rLb6RXgyO1qWM2Uit0pfxk3bBa6kkMvH+8No6kLWb0QX05zQrt1uiH6ckB4OmsCaKQwGgCSjulpHqbNj/PNzWsvxwkOx9UUG+yZboRo3GOA748otr2DYapTz4rSf2wWyGKVRwLOlkLpF/6WRofP7yzv38Cfg4PPrrz9QSwcIrwqFNSUCAAAiBgAAUEsBAhQDFAAIAAgA/Lk5T68KhTUlAgAAIgYAAA8AIAAAAAAAAAAAALSBAAAAAENvb2xBbmltYXRlLnNjbVVUDQAHXR+MXbEfjF1dH4xddXgLAAEE6AMAAAToAwAAUEsFBgAAAAABAAEAXQAAAIICAAAAAA==

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment