So basically I am trying to figure out how to relate two, or more, bitmaps together. So when one bitmap is moved and/or rotated, the other bitmap moves with it, but that I can still access the second bitmap separately.
I want to be able to have a spaceship. This spaceship should have turrets that can move independently. Now, I've managed to make this happen by creating a ship bitmap, a turret bitmap, and a tempship bitmap. I then put the ship bitmap on the tempship bitmap. Then I put the rotated turret on the tempship bitmap based on the spot I want. Then I rotate the tempship bitmap. The problem is that then I have no way of indicating which spot the turret is at when the whole thing is rotated.
I'll list my questions now.
1. Am I doing the right thing by copying multiple bitmaps to a final bitmap to associate various moving bitmaps together?
2. How do I find a specific area of a bitmap on the screen after it has been rotated so I can create new bitmaps at this origin?
//Create ship bitmap
shipImage = al_load_bitmap("spaceship.bmp");
//Create turret bitmap
turretImage = al_load_bitmap("turret.bmp");;
//Create temp bitmap
tempImage = al_create_bitmap(shipImageHeight * 1.2, shipImageWidth * 1.2);
//RENDER IN GAME LOOP HERE
//Combine ship and turret
al_draw_bitmap(shipImage, tempImageWidthDiff, tempImageHeightDiff, 0);
al_draw_rotated_bitmap(turretImage, turretImageWidth / 2, turretImageHeight / 2, 20 + tempImageWidthDiff, 100 + tempImageHeightDiff, ConvertDegreeToRadian(turretAngle), 0);
al_draw_scaled_rotated_bitmap(tempImage, tempImageWidth / 2, tempImageHeight / 2, WIDTH / 2, HEIGHT / 2, zoom, zoom, ConvertDegreeToRadian(shipAngle), 0);
Thanks for any help you can provide to my newbie game programmer self!