1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
ALLEGRO_BITMAP *buffer = al_create_bitmap(64, 64);
al_set_target_bitmap(buffer);
if (players[i].type == 0)
al_draw_bitmap_region(playerImage1, player.width * players[i].frame, 0, player.width, player.height, 0, 0, 0);
else if (players[i].type == 1)
al_draw_bitmap_region(playerImage2, player.width * players[i].frame, 0, player.width, player.height, 0, 0, 0);
al_set_target_bitmap(al_get_backbuffer(display));
al_draw_rotated_bitmap(buffer, player.width / 2, player.height / 2, players[i].x, players[i].y, players[i].dir, NULL);
double sintheta = sin(players[i].dir);
double costheta = cos(players[i].dir);
players[i].gunX = players[i].x + (players[i].gunOffX * cos(players[i].dir)) - (players[i].gunOffY * sin(players[i].dir));
players[i].gunY = players[i].y + (players[i].gunOffY * cos(players[i].dir)) + (players[i].gunOffX * sin(players[i].dir));
ALLEGRO_BITMAP *buffer2 = al_create_bitmap(64, 64);
al_set_target_bitmap(buffer2);
buffer = NULL;
al_draw_bitmap_region(weaponImage, 64 * players[i].weapon, 0, 64, 64, 0, 0, 0);
al_set_target_bitmap(al_get_backbuffer(display));
al_draw_rotated_bitmap(buffer2, 32, 32, players[i].gunX, players[i].gunY, players[i].dir, 0);
|