1. Having trouble staying logged in? Note: We are rpgcodex.NET not .COM. Trying to login via .com will cause issues. Make sure you are on rpgcodex.net to login and all will be fine.

    And if the Password Recovery doesn't work (there was an error transitioning accounts during the upgrade), use the "contact us" link right down the bottom right of the forums and harass us about it. Include your account name and its e-mail address (or whatever parts of it you remember).

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

Why can't I line up these fucking tiles!

Discussion in 'Prosper's Funhouse' started by crojipjip, Jun 18, 2012.

  1. crojipjip Artist Formerly Known as Prosper

    crojipjip
    Joined:
    Jan 11, 2012
    Posts:
    2,699
    Click here and disable ads!
    Here is the code. I am storing the tile locations as points. but the fuck fuck code no matter what i do with the bools and counting can't get the bitch to line up.
    Code:
        SPoint2D coords[nMaxTiling][nMaxTiling];
        void FixupCoords()
        {
            bool bSwitch = false;
            int nMeTry = 0;
            bool bDerp = false;
            for (int xxx = 0; xxx < tilesAcrossX; ++xxx)
            {
     
                for (int yyy = 0; yyy < tilesAcrossY; ++yyy)
                {
                    int nOffset = 16;
     
                    if (bSwitch == true) {
     
     
                        coords[xxx][yyy].x = (xxx * nTileSizeX);
                        coords[xxx][yyy].y = (yyy - elevation) * nTileSizeY ;
                        bSwitch = !bSwitch;
     
                        if (bDerp == true)
                        {
                              coords[xxx][yyy].x = (xxx * nTileSizeX) + (nTileSizeX / 2) ;
                              coords[xxx][yyy].y = (yyy - elevation) * nTileSizeY - (nTileSizeY / 2) ;
                        }
     
                    }
                    else {
                        coords[xxx][yyy].x = (xxx * nTileSizeX) + (nTileSizeX / 2) ;
                        coords[xxx][yyy].y = (yyy - elevation) * nTileSizeY - (nTileSizeY / 2) ;
                        bSwitch = !bSwitch;
     
                        if (bDerp == true)
                        {
                              coords[xxx][yyy].x = (xxx * nTileSizeX);
                              coords[xxx][yyy].y = (yyy - elevation) * nTileSizeY ;
                        }
     
                    }
     
                }
                ++nMeTry;
                if (nMeTry == 2) {
     
                     bDerp = true;
     
                }
                if (nMeTry == 4) {
     
                     bDerp = false;
                     nMeTry = 0;
                }
     
     
     
            }
        }
    
    http://i.imgur.com/Y46es.png
    [IMG]
  2. crojipjip Artist Formerly Known as Prosper

    crojipjip
    Joined:
    Jan 11, 2012
    Posts:
    2,699
    FUCK IT. I GIVE UP. I WRATHER BE AN ARTIST THEN THIS BULLSHIT. fucking far out. fucking FARRRRRRRRRRRRRRR. derpin.tityiioyuioyu.

    I am going to go get angryu,
  3. EG Nullified

    EG
    Joined:
    Oct 12, 2011
    Posts:
    3,348
    Maybe you're adding 3 to the pretty purple cube. :(

    Unless you mean pixel-perfect alignment of the edges of each title to the next tile, with the same padding?
  4. joeydohn Learned

    joeydohn
    Joined:
    Apr 18, 2012
    Posts:
    343
    Excellently descriptive variable names crojipjip.
  5. crojipjip Artist Formerly Known as Prosper

    crojipjip
    Joined:
    Jan 11, 2012
    Posts:
    2,699
    it is the fucking gap. itn ever goes away!

    http://i.imgur.com/RwE48.png
    [IMG]

    Code:
            bool bDown = false;
            for (int xxx = 0; xxx < tilesAcrossX; ++xxx)
            {
     
                for (int yyy = 0; yyy < tilesAcrossY; ++yyy)
                {
     
                        if (bDown == false) {
                                coords[yyy][xxx].x = (xxx * nTileSizeX);
                                coords[yyy][xxx].y = (yyy - elevation) * nTileSizeY ;
                        }
                        else {
                                coords[yyy][xxx].x = (xxx * nTileSizeX) + (nTileSizeX / 2);
                                coords[yyy][xxx].y = (yyy - elevation) * nTileSizeY  + (nTileSizeY / 2);
                        }
     
     
                        bDown = !bDown;
     
     
                }
            }
  6. crojipjip Artist Formerly Known as Prosper

    crojipjip
    Joined:
    Jan 11, 2012
    Posts:
    2,699
    damnit damnit damnit. rows are back to jagged again in this mod:

    Code:
    bool bDown = false;
            int nRow = 0;
            for (int xxx = 0; xxx < tilesAcrossX; ++xxx)
            {
     
                for (int yyy = 0; yyy < tilesAcrossY; ++yyy)
                {
                        int nOffset = 0;
                        if (nRow >= 2) {
                            nOffset = 16;
                        }
     
                        if (bDown == false) {
                                coords[yyy][xxx].x = (xxx * nTileSizeX);
                                coords[yyy][xxx].y = (yyy - elevation) * nTileSizeY - nOffset;
                        }
                        else {
                                coords[yyy][xxx].x = (xxx * nTileSizeX) + (nTileSizeX / 2);
                                coords[yyy][xxx].y = (yyy - elevation) * nTileSizeY  + (nTileSizeY / 2) - nOffset;
                        }
     
                        bDown = !bDown;
                }
                ++nRow;
                if (nRow == 4)
                nRow = 0;
            }
    it is as if some constant is being overlooked....
  7. crojipjip Artist Formerly Known as Prosper

    crojipjip
    Joined:
    Jan 11, 2012
    Posts:
    2,699
    i did it!

    http://i.imgur.com/8HM7r.png
    [IMG]

    damn that took ar eally long time.

    here is what i did in code
    Code:
    SPoint2D coords[nMaxTiling][nMaxTiling];
        void FixupCoords()
        {
            bool bBit = false;
            int nCounterY = 0;
            for (int yyy = 0; yyy < tilesAcrossY; ++yyy)
            {
     
                for (int xxx = 0; xxx < tilesAcrossX; ++xxx)
                {
                    int x = xxx * nTileSizeX;
                    int y = yyy * nTileSizeY;
     
                    if (nCounterY == 1) {
                        x = (xxx - 1) * nTileSizeX + (nTileSizeX / 2);
                        y = (yyy) * (nTileSizeY / 2);
                    }
                    else if (nCounterY == 2) {
                        x = (xxx - 1) * nTileSizeX + (nTileSizeX);
                        y = (yyy) * (nTileSizeY / 2);
                    }
                    else if (nCounterY == 3) {
                       x = (xxx - 1) * nTileSizeX + (nTileSizeX / 2);
                       y = (yyy) * (nTileSizeY / 2);
                    }
                    else if (nCounterY == 4) {
                       x = (xxx - 1) * nTileSizeX + (nTileSizeX);
                       y = (yyy) * (nTileSizeY / 2);
                    }
                    else if (nCounterY == 5) {
                       x = (xxx - 1) * nTileSizeX + (nTileSizeX / 2);
                       y = (yyy) * (nTileSizeY / 2);
                    }
                    else if (nCounterY == 6) {
                       x = (xxx - 1) * nTileSizeX + (nTileSizeX);
                       y = (yyy) * (nTileSizeY / 2);
                    }
                    else if (nCounterY == 7) {
                        x = (xxx - 1) * nTileSizeX + (nTileSizeX / 2);
                        y = (yyy) * (nTileSizeY / 2);
                    }
                    else if (nCounterY == 8) {
                        x = (xxx - 1) * nTileSizeX + (nTileSizeX);
                        y = (yyy) * (nTileSizeY / 2);
                    }
                    else if (nCounterY == 9) {
                       x = (xxx - 1) * nTileSizeX + (nTileSizeX / 2);
                       y = (yyy) * (nTileSizeY / 2);
                    }
     
     
     
                    coords[yyy][xxx] = SPoint2D(x, y);
                }
                ++nCounterY;
     
            }
        }
    
    Ærelian Brofists this.
  8. EG Nullified

    EG
    Joined:
    Oct 12, 2011
    Posts:
    3,348
    This is my solution.

    You stole it!
  9. crojipjip Artist Formerly Known as Prosper

    crojipjip
    Joined:
    Jan 11, 2012
    Posts:
    2,699
    don't worry the final solution to the steve wilkos problem will clear up all the confusion.
  10. EG Nullified

    EG
    Joined:
    Oct 12, 2011
    Posts:
    3,348
    And I had thought we were friends.:mad:
  11. crojipjip Artist Formerly Known as Prosper

    crojipjip
    Joined:
    Jan 11, 2012
    Posts:
    2,699
    Here is a modified solution.
    Code:
       void FixupCoords()
        {
            bool bBit = false;
            int nCounterY = 0;
            for (int yyy = 0; yyy < tilesAcrossY; ++yyy)
            {
     
                for (int xxx = 0; xxx < tilesAcrossX; ++xxx)
                {
                    int x = xxx * nTileSizeX;
                    int y = yyy * nTileSizeY;
     
                    if (bBit == true) {
                         x = (xxx - 1) * nTileSizeX + (nTileSizeX / 2);
                         y = (yyy) * (nTileSizeY / 2);
                    }
                    else
                    {
                         x = (xxx - 1) * nTileSizeX + (nTileSizeX);
                         y = (yyy) * (nTileSizeY / 2);
                    }
        
                    coords[yyy][xxx] = SPoint2D(x, y);
                }
                bBit = !bBit;
                ++nCounterY;
     
            }
        }
    
    As you can see I reduced the code and just flip the bool after each full crossing. This was an obvious optimization. fuck optimization. this is readable lovliness.

(buying stuff via the above links helps us pay the hosting bills)