Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualNyssa

Posted 29 January 2013 - 06:21 PM

Since you're using a char array it shouldn't take too much to detect if a slope is coming:

 

int tilePositionX, tilePositionY;
char tileArray[mapSizeX][mapSizeY];

int nextXTile = tilePositionX+1;//+1 assuming you are moving forward
int yTileBelow = tilePositionY+1;

if ((nextXTile < mapSizeX) && (yTileBelow < mapSizeY))
{
    //where 0 is solid and 1 is hollow
    if (tileArray[nextXTile][yTileBelow]) == 1)
    {
        //the next tile is on a slope or there is a hole
    }
}

#2Nyssa

Posted 29 January 2013 - 06:20 PM

Since you're using a char array it shouldn't take too much to detect if a slope is coming:

 

int tilePositionX, tilePositionY;
char tileArray[mapSizeX][mapSizeY];

int nextXTile = tilePositionX+1;//+1 assuming you are moving forward
int yTileBelow = tilePositionY+1;

if ((nextXTile < mapSizeX) && (yTileBelow < mapSizeY))
{
    //where 0 is solid and 1 is hollow
    if (tileArray[nextXTile][yTileBelow]) == 1)
    {
        //the next tile is on a slope
    }
}

#1Nyssa

Posted 29 January 2013 - 06:20 PM

Since you're using a char array it shouldn't take too much to detect if a slope is coming:

 

int tilePositionX, tilePositionY;
char tileArray[mapSizeX][mapSizeY];

int nextXTile = tilePositionX+1;//+1 assuming you are moving forward
int yTileBelow = tilePositionY+1;

if ((nextXTile < mapSizeX) && (yTileBelow < mapSizeY))
{
    //where 0 is solid and 1 is hollow
    if (tileArray[nextXTile][yTileBelow]) == 1)
    {
        //the next tile is on a slope
    }
}

 

You'll need to do some bounds checking there too.


PARTNERS