I'm looking into find out how to create simple animation. For the project to learn this with I'm using Allegro. Can someone give me hints on this, please?
I'm looking into find out how to create simple animation. For the project to learn this with I'm using Allegro. Can someone give me hints on this, please?
Check out this and the Allegro links in the sticky . Basically, you just print the image in a different spot everytime you update the screen.
Last edited by o0obruceleeo0o; 08-29-2003 at 08:41 PM.
Actually that is movement. To make an animation you periodically print different images in the same location, fooling the eye to think the image is animated.
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
Or different images in different locations for animated movement :P
Away.
Oops... I should have been more specific. What I meant by "print the image in a different spot" was a different spot in an aray of images, for each frame (thats my story and I'm sticking to it)
edit: heres the animation one... http://www.loomsoft.net/resources/al...ut_lesson7.htm
Last edited by o0obruceleeo0o; 08-30-2003 at 02:47 PM.
I now have some code to show my plan on accomplishing this. My new problem is how do I make so I can play the same animation on multiple locations? Say at the top and bottom? I also want to be able to play animation within the game. The code I have now is for the intro.
Code:void play_animation(BITMAP* bmp, BITMAP** animation, int startX, int startY, int endX, int endY) { int x = startX, y = startY; int i = 0; while(x+animation[i]->w < endX && !keypressed()) { if(animation_timer > 1) { clear_bitmap(bmp); draw_sprite(bmp,animation[i],x,y); i++; if(i > 1) i = 0; x++; animation_timer = 0; } blit(bmp,screen,0,0,0,0,640,480); } }