Page 1 of 1

reverse function.

PostPosted: Tue Apr 17, 2007 5:31 pm
by Sgt. Sparky
here is a reverse function I made. :D
put this in global code and add it:
here is the new one,
Code: Select all
char smpl[255];
void sample(char s[255])
{
    strcpy(smpl, s);
}
void printsample(char s[255])
{
    strcpy(s, smpl);
}
void reverse(char s[255], int spd)
{
     int c, i, j;
     int wait;
     sample(s);
 
     wait -= 1;
     if(wait <= 0) {
     for(i = 0, j = strlen(smpl)-1; i < j; i++, j--) {
           c = smpl[i];
           smpl[i] = smpl[j];
           smpl[j] = c;
      }
      wait = spd;
      printsample(s);
      }
}

all you must do is add it into the global code.
on the draw actor event you use,
Code: Select all
reverse(text, 30);

change the number to the right to change how fast the transition is.
the higher the number, the slower it is. :D
it is a very simple function. :)

I am going to make a version that types it out slowly some time. :D

PostPosted: Tue Apr 17, 2007 8:27 pm
by Fuzzy
Cool little function!

PostPosted: Wed Apr 18, 2007 12:45 am
by Game A Gogo
nice function!

PostPosted: Wed Apr 18, 2007 1:15 am
by Sgt. Sparky
Thanks, I do not know weither it was worth putting into advanced topics though :(