Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


#ActualBornToCode

Posted 21 January 2013 - 06:35 PM

struct Rect

{

  int x;

  int y;

};

All you need to do is divide the tile image width and height by whatever the tile width and tile height you want. Then from that point you can just create an nxm Rect then assign the x and y value for each one of the tile. Then when you reference an tile from Tiles you can just subtract 1 from it to reference the proper rect index and that should contains your x and y value of where in the image that tile begins at. You do not need the width and height since you already know it is 32x32


#1BornToCode

Posted 21 January 2013 - 06:34 PM

struct Rect

{

  int x;

  int y;

};

All you need to do is divide the tile image width and height by whatever the tile width and tile height you want. Then from that point you can just create an nxm Rect then assign the x and y value for each one of the tile. Then when you reference an tile from Tiles you can just subtract 1 from 1 to reference the proper rect index and that should contains your x and y value of where in the image that tile begins at. You do not need the width and height since you already know it is 32x32


PARTNERS