About symbols...

Non-platform specific questions.

Re: About symbols...

Postby edh » Sat Mar 15, 2008 4:52 pm

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.
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score

Re: About symbols...

Postby Wayra Condor » Sat Mar 15, 2008 9:06 pm

...
...
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?
Current proyect: The King of Peru 3 (0,1%...Now reutrning form a long break!)
User avatar
Wayra Condor
 
Posts: 27
Joined: Sat Dec 08, 2007 5:05 pm
Location: Cuzco, Peru
Score: 1 Give a positive score

Re: About symbols...

Postby edh » Sun Mar 16, 2008 12:11 am

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?
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score

Re: About symbols...

Postby Wayra Condor » Mon Mar 17, 2008 2:33 am

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?
Current proyect: The King of Peru 3 (0,1%...Now reutrning form a long break!)
User avatar
Wayra Condor
 
Posts: 27
Joined: Sat Dec 08, 2007 5:05 pm
Location: Cuzco, Peru
Score: 1 Give a positive score

Previous

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron