Page 1 of 1

Unknown Error? --Fixed--

PostPosted: Wed Oct 26, 2011 6:50 pm
by Hblade
EDIT:
FIXED! I had to remove "int" and make a real variable >.> in the part that controls the fading. (int varx;).

There seems to be some sort of error...

when I added this code:
Code: Select all
//Define Controls for keyboard
        #define KeyRight key[KEY_d]
        #define KeyLeft key[KEY_a]
        #define KeyUp key[KEY_w]
        #define KeyDown key[KEY_s]
        #define KeyB1 key[KEY_i]
        #define KeyB2 key[KEY_l]
        #define KeyB3 key[KEY_k]
        #define KeyB4 key[KEY_j]
        #define KeyB5 key[KEY_q]
        #define KeyB6 key[KEY_e]
        #define KeyB7 key[KEY_u]
        #define KeyB8 key[KEY_o]
        #define KeyB9 key[KEY_f]
        #define KeyB10 key[KEY_g]
 
        //Define Controls for Joystick
        #define B1 BUTTON[0];
        #define B2 BUTTON[1];
        #define B3 BUTTON[2];
        #define B4 BUTTON[3];
        #define B5 BUTTON[4];
        #define B6 BUTTON[5];
        #define B7 BUTTON[6];
        #define B8 BUTTON[7];
        #define B9 BUTTON[8];
        #define B10 BUTTON[9];
 
        #define Press_DOWN (KeyDown==1 || yaxis>Offset)
        #define Press_UP (KeyUp==1 || yaxis<-Offset)
        #define Press_LEFT (KeyLeft==1 || yaxis<-Offset)
        #define Press_RIGHT (KeyRight==1 || yaxis<-Offset)
        #define Press_B1 (KeyB1==1 || BUTTON[0]==1)
        #define Press_B2 (KeyB2==1 || BUTTON[1]==1)
        #define Press_B3 (KeyB3==1 || BUTTON[2]==1)
        #define Press_B4 (KeyB4==1 || BUTTON[3]==1)
        #define Press_B5 (KeyB5==1 || BUTTON[4]==1)
        #define Press_B6 (KeyB6==1 || BUTTON[5]==1)
        #define Press_B7 (KeyB7==1 || BUTTON[6]==1)
        #define Press_B8 (KeyB8==1 || BUTTON[7]==1)
        #define Press_B9 (KeyB9==1 || BUTTON[8]==1)
        #define Press_B10 (KeyB10==1 || BUTTON[9]==1)

        //Generate Definitions
        #define true 1
        #define false 0
        #define Joy1 BUTTON[0]
        #define Joy2 BUTTON[2]
        #define Joy3 BUTTON[3]
        #define Joy4 BUTTON[4]
        #define Joy5 BUTTON[5]
        #define Joy6 BUTTON[6]
        #define Joy7 BUTTON[7]
        #define Joy8 BUTTON[8]
        #define Joy9 BUTTON[9]
        #define xaxis JOYX
        #define yaxis JOYY
 
        //Code Variables
        int IsPress[30];
        int Offset=10000;
        char *key;
        int BUTTON[10];
        double JOYX=GetJoystick1Axis(0), JOYY=GetJoystick1Axis(1);

    //Enable Controls
    void EnableControls(int JOY, int KBD) {
        int i;
        switch(JOY) {
            case 0:
            break; case 1:
            for (i=0;i<9;i++) {
            BUTTON[i]=GetJoystick1Button(i);
                          }
            break; }
        switch(KBD) {
            case 0:
            break; case 1:
            key=GetKeyState();
            break; }
 
        IsPress[0]=KeyB1;
        IsPress[1]=KeyB2;
        IsPress[2]=KeyB3;
        IsPress[3]=KeyB4;
        IsPress[4]=KeyB5;
        IsPress[5]=KeyB6;
        IsPress[6]=KeyB7;
        IsPress[7]=KeyB8;
        IsPress[8]=KeyB9;
        IsPress[9]=KeyB10;
        IsPress[10]=B1;
        IsPress[11]=B2;
        IsPress[12]=B3;
        IsPress[13]=B4;
        IsPress[14]=B5;
        IsPress[15]=B6;
        IsPress[16]=B7;
        IsPress[17]=B8;
        IsPress[18]=B9;
        IsPress[19]=B10;
        IsPress[20]=KeyUp-KeyDown;
        IsPress[21]=KeyLeft-KeyRight;
        if (JOYX>Offset) {
            IsPress[22]=1; }
        if (JOYX<-Offset) {
            IsPress[22]=2; }
        if (JOYX>-Offset && JOYX<Offset) {
            IsPress[22]=0; }
        if (JOYY>Offset) {
            IsPress[23]=1; }
        if (JOYY<-Offset) {
            IsPress[23]=2; }
        if (JOYY>-Offset && JOYY<Offset) {
            IsPress[23]=0; }
                                          }



Something strange happened. During the logo, (The very intro of the game), it fades in, but never fades out and for some annoying reason, everything else happens. The music plays, and the leaves get created. O__o? What is going on? Here's the script that controls the fading
Code: Select all
int varx;
switch(varx) {
    case 1:
    transp-=.01;
    break;
    case 2:
    transp+=.01;
    break;
    case 3:
    Title.transp-=.008;
    Title2.transp-=.01;
    Menu.transp-=.05;
    AC=1;
    break;
            }
t++;
switch(t) {
    case 60:
    varx=1;
    break;
    case 300:
    varx=2;
    break;
    case 420:
    varx=3;
    break;
    case 480:
    PlayMusic2("data/Leaf.ogg", 1.000000, 0, HIGH_PRIORITY_MUSIC);
    break;
          }
if (t>=500) {
    if (t==515) {
        t=500;
        CreateActor("leaf", "leaf1", "(none)", "(none)", -24, rand(480)-rand(240), true);
                }
            }


Any help would be appreciated ^^