Public Group

# 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.

## 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;

}
}



• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 13
• 9
• 11
• ### Forum Statistics

• Total Topics
634094
• Total Posts
3015466
×