-2

I am making a mini rpg tile game and I have an issue.
There are going to be 208 tiles on the screen and here comes my problem(using SDL)

How do you create multiple surfaces without it looking like this:

enter image description here

Would there be a loop for these kind of things? This doesn't look healthy at all

this
  • 5,229
  • 1
  • 22
  • 51
  • is that really required? I have no problem other than SDL_Surface* Tile1 = NULL; SDL_Surface* Tile2 = NULL; I just need to know if it can be looped .w. – Yoshipouki Aug 07 '15 at 08:35
  • 2
    I think there is a deeper problem here. Pick a book: https://stackoverflow.com/questions/562303/the-definitive-c-book-guide-and-list – this Aug 07 '15 at 08:36
  • I meant to declare all the Surfaces in int Game – Yoshipouki Aug 07 '15 at 08:40

1 Answers1

0

Just use an array like

SDL_Surface* Tiles[208];

or a pointer to pointer to SDL_Surface and initialize it properly

SDL_Surface **tiles;
bgeschka
  • 102
  • 4
  • it worked pretty well ! Thank you ! but when i do Tiles[207] = SDL_LoadBMP("tiles/88.bmp"); it's not working ow // EDIT: I mean it's working for the declaration part but how do i attribute to, let's say Tile 206 an image? – Yoshipouki Aug 07 '15 at 08:55
  • 2
    @Yoshipouki Dude, pick a C book for beginners. – this Aug 07 '15 at 08:57