![]() |
|
Animation on background |
qqq m
Member #7,373
June 2006
|
I made animation but I want to do this animation on background picture.
|
Indeterminatus
Member #737
November 2000
![]() |
Please, put [ code ] and [ /code ] tags around your code (without the spaces). _______________________________ |
BAF
Member #2,981
December 2002
![]() |
[code] and [/code] |
ImLeftFooted
Member #3,935
October 2003
![]() |
A few notes on your code: if(frame<f+5) draw_sprite(buffer, (BITMAP*)A[x].dat, 0, 0); masked_blit(buffer, screen, 0, 0, 175, 72, buffer->w, buffer->h);//Blit the buffer clear_bitmap(buffer);//Clear the buffer It looks like you want some brackets for that if statement, depending on the speed that speed_counter is incremented it looks like the picture should flicker a lot or even not appear at all. Heres the code with some brackets. if(frame<f+5) { draw_sprite(buffer, (BITMAP*)A[x].dat, 0, 0); masked_blit(buffer, screen, 0, 0, 175, 72, buffer->w, buffer->h);//Blit the buffer clear_bitmap(buffer);//Clear the buffer } You probably want to call the 'blit' function instead of the 'masked_blit' function. Unless you're doing some crazy effect with your buffer, you can make your game run make faster and respond more smoothly by replacing it with a blit. Heres how I would write the chunk of code you wrote: if(frame<f+5) { draw_sprite(buffer, (BITMAP*)A[x].dat, 0, 0); blit(buffer, screen, 0, 0, 175, 72, buffer->w, buffer->h);//Blit the buffer clear_bitmap(buffer);//Clear the buffer } You also probably want to blit the buffer to the screen at 0,0. Heres the final code: if(frame<f+5) { draw_sprite(buffer, (BITMAP*)A[x].dat, 0, 0); blit(buffer, screen, 0, 0, 0, 0, buffer->w, buffer->h);//Blit the buffer clear_bitmap(buffer);//Clear the buffer }
|
qqq m
Member #7,373
June 2006
|
ty for fixed my program but you still didnt answer my question |
LennyLen
Member #5,313
December 2004
![]() |
Quote: ty for fixed my program but you still didnt answer my question Nobody answered your question because you didn't ask a question. Neither your original comments, nor your code snippet make it clear what you are really trying to do, or what the problem is. If you want help, you need to help others by clearly describing the problem, and what you are trying to achieve.
|
BAF
Member #2,981
December 2002
![]() |
You can't. You have to reblit the background to the buffer each loop, before you draw the appropriate frame of the animation. |
|