Advertisement Jump to content
Sign in to follow this  
kingpinzs

2d direct draw map help rotating on y axis

This topic is 4992 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How can i roatae my map on its y axis so all the tiles line up. I need to ratat the y axis by 45 degrees or less. How is this done? thanks.
void draw_tiles(void)
{
    for(Tileset.y= 0; Tileset.y < Mapy;Tileset.y++)
    {for(Tileset.x= 0; Tileset.x < Mapx; Tileset.x++)
    {  //what does this do?
      
      Tileset.scroll_x = Tileset.x + (Tileset.world_camerax/Tileset.Tile_size);//this allows scrolling on y axis
      Tileset.scroll_y = Tileset.y+   (Tileset.world_cameray/Tileset.Tile_size);//this allows scrolling on x axis

      
      Tileset.offset_x = Tileset.world_camerax % Tileset.Tile_size;       
      Tileset.offset_y = Tileset.world_cameray % Tileset.Tile_size;   
          
             
          Tileset.tiles = map[Tileset.scroll_y][Tileset.scroll_x];
      


    tile_src.left = ((Tileset.tiles -1)%4) *Tileset.Tile_size;
    tile_src.top =  ((Tileset.tiles -1)/4) * Tileset.Tile_size;
    tile_src.right = tile_src.left + Tileset.Tile_size;
    tile_src.bottom = tile_src.top + Tileset.Tile_size; 

dstr.left=((Tileset.x-Tileset.y)*Tileset.Tile_size/2)/*- Tileset.offset_x */+(800/2);
dstr.right=dstr.left + Tileset.Tile_size;

dstr.top= ((Tileset.y+Tileset.x)*Tileset.Tile_size/2)/*- Tileset.offset_y*/-(600/2);
dstr.bottom=dstr.top + Tileset.Tile_size;


bout<<dstr.left<<" "<<dstr.top<<" ";

//the above is for debugging use

lpBackBuffer->Blt(&dstr,g_pddTile,&tile_src,DDBLT_WAIT|DDBLT_KEYSRC,NULL);  
} 
; 
bout<<endl;

 }
 } 

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!