Page 2 of 2

Re: About symbols...

PostPosted: Sat Mar 15, 2008 4:52 pm
by edh
Oh, I see. You are having some trouble taking the example and applying it to your game.

Just replace count with "move" or "action" or whatever you want. You could even pass it as a variable to a function.

I'll send another example if this does not make sense.

Re: About symbols...

PostPosted: Sat Mar 15, 2008 9:06 pm
by Wayra Condor
...
...
I don't get it, what do I have to replase in order to use variables (or whatever you thing will solve this)?
Here is the code you gave me:
Code: Select all
if (!p1cov)
{
    switch(p1count)
    {
        case 0:
            strcpy(p1_martialart_text.text, "2º martial art");
            break;
        case 1:
            strcpy(p1_martialart_text.text, "Weapon");
            break;
        case 2:
            strcpy(p1_martialart_text.text, "1º martial art");
            break;
        default:
            strcpy(p1_martialart_text.text, "1º martial art");
             }
    p1count = (p1count + 1) % 3;
    yvelocity = -10;
    p1cov += 1;
}


What do I have to change here?

Re: About symbols...

PostPosted: Sun Mar 16, 2008 12:11 am
by edh
try something like this

Code: Select all
// global
#define MEGAKICK 1
#define ULTRAPUNCH 2

void changeText(int actionFlag)
{
  // switch statements are like big nested if...else statements, but clearer
  switch (actionFlag)
  {
    case 1:
      strcpy(p1_martialart_text.text, "megakick");
      break;
    case 2:
      strcpy(p1_martialart_text.text, "ultrapunch");
      break;
  }
}
   


then just call changeText whereever you like.

Is that enough?

Re: About symbols...

PostPosted: Mon Mar 17, 2008 2:33 am
by Wayra Condor
Just in case I won't get dizzier, the variables you put are "MEGAKICK" and "ULTRAPUNCH" then I apply them as normal variables on the player, right?