reverse function.

You must understand the Game Editor concepts, before post here.

reverse function.

Postby Sgt. Sparky » Tue Apr 17, 2007 5:31 pm

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
Last edited by Sgt. Sparky on Wed Apr 18, 2007 3:41 pm, edited 2 times in total.
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Fuzzy » Tue Apr 17, 2007 8:27 pm

Cool little function!
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Postby Game A Gogo » Wed Apr 18, 2007 12:45 am

nice function!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Sgt. Sparky » Wed Apr 18, 2007 1:15 am

Thanks, I do not know weither it was worth putting into advanced topics though :(
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest