Thread: simple animation

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    380

    simple animation

    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?
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

  2. #2
    plzduntlakliekthiskthx
    Join Date
    Oct 2002
    Posts
    138
    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.

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    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.

  4. #4
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Or different images in different locations for animated movement :P
    Away.

  5. #5
    plzduntlakliekthiskthx
    Join Date
    Oct 2002
    Posts
    138
    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.

  6. #6
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    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);               
       }
    }
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. creating very simple text editor using c
    By if13121 in forum C Programming
    Replies: 9
    Last Post: 10-19-2010, 05:26 PM
  2. Simple message encryption
    By Vicious in forum C++ Programming
    Replies: 10
    Last Post: 11-07-2004, 11:48 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Simple simple program
    By Ryback in forum C++ Programming
    Replies: 10
    Last Post: 09-09-2004, 05:48 AM
  5. Need help with simple DAQ program
    By canada-paul in forum C++ Programming
    Replies: 12
    Last Post: 03-15-2002, 08:52 AM