This code works great, but only allows a 90 degree rotation of the sprite. I assume this is because of allegro and I think every other graphics lib assuming top left is 0,0 and going from there so I am only playing in one quad... I am wondering how to make it rotate all 360 degrees do I just make a correction factor based on the screen size or what?
Code:
int main()
{
ini();
player = load_bitmap("Player.bmp",NULL);
BUFFER = create_bitmap(scrx,scry);
while(!key[KEY_ESC])
{
int angle = fixatan2(mouse_y, mouse_x);
rotate_sprite(BUFFER,player,(scrx/2),(scry/2),angle);
show_mouse(BUFFER);
blit(BUFFER,screen,0,0,0,0,scrx,scry);
}
return 0;
}
END_OF_MAIN()
Answered my own question. Subtracting half of the screen size from each var allows for 360 degree rotation. center the sprite by subbing half the size in x and y... Now to get a grappling hook working for movement...