Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualMrPhoenix

Posted 21 January 2013 - 04:46 PM

ok i got a tilesheet of 1600x1600 in size and each tile is 32px x 32px

 

i want to assign the tile like 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,etc

but im confused on the math on how to convert the tile number to the sprite_x_start and sprite_y_start

 

 

    void draw_tile(int tile_num, int x, int y, SDL_Surface *output_surface) {
        

        draw_sprite(sprite_sheet, output_surface, draw_x_spot, draw_y_spot ,sprite_x_start, sprite_y_start ,32,32);

    }

#1MrPhoenix

Posted 21 January 2013 - 04:46 PM

ok i got a tilesheet of 1600x1600 in size and each tile is 32px x 32px

 

i want to assign the tile like 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,etc

but im confused on the math on how to convert the tile number to the sprite_x_start and sprite_y_start

 

 

    void draw_tile(int tile_num, int x, int y, SDL_Surface *dest) {
        

        draw_sprite(sprite_sheet, output_surface, draw_x_spot, draw_y_spot ,sprite_x_start, sprite_y_start ,32,32);

    }

 

 


PARTNERS