Animating Multiple Sprites

This is a discussion on Animating Multiple Sprites within the Game Programming forums, part of the General Programming Boards category; Hello all! Im am new to this message board and also new to programming in C. I have been learning ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    118

    Question Animating Multiple Sprites

    Hello all!

    Im am new to this message board and also new to programming in C. I have been learning C for about a month now, and finally I think I know enough to make a simple graphic game. I am using Mode 13h and am compiling with Borland C++ 3.1, but am strickly using C. My problem is I can't seem to animate multiple sprites on the screen without it slowing down other sprites. I had a similar problem with keyboard input, but solved that with the kbhit function. I can't seem to understand how an animated sprite using a loop will allow for the other sprites on the screen to be animated simultaniously. If anyone can help it would be greatly appreciated. I know I am probably using the wrong method by using a loop, but I can't think (or find) any other way of doing it. There is still much I obviously have to learn. Thanks!

    Tommaso
    "The distinction between past, present and future is only an illussion, even if a stunning one."
    -Albert Einstein

  2. #2
    Peace
    Join Date
    Aug 2001
    Posts
    1,510
    Basic Concept:

    a) You'll need a timer.

    b) Each sprite needs a variable that indicates its current frame of animation.

    c) When you go to draw a sprite, check the time. If x amount of time has past, increment the sprite frame variable. If there are say 3 frames to the sprite, make sure that you loop your count back to 0 after 3. Draw the sprite normally.
    "There's always another way"
    -lightatdawn (lightatdawn.cprogramming.com)

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    118
    I read a little more about it and seemed to find what I needed. Your post pointed me in the right dirrection though. Thanks for your help.
    "The distinction between past, present and future is only an illussion, even if a stunning one."
    -Albert Einstein

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 06-08-2009, 04:03 PM
  2. Animating Multiple Object - [Open Gl]
    By Tonto in forum Game Programming
    Replies: 6
    Last Post: 09-29-2006, 07:31 PM
  3. Phantom redefinition
    By CodeMonkey in forum C++ Programming
    Replies: 6
    Last Post: 06-12-2005, 06:42 PM
  4. Linker errors - Multiple Source files
    By nkhambal in forum C Programming
    Replies: 3
    Last Post: 04-24-2005, 03:41 AM
  5. Replies: 1
    Last Post: 05-01-2003, 03:52 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21