+ Sprites n allegro

This is a discussion on + Sprites n allegro within the Game Programming forums, part of the General Programming Boards category; When moving the sprites they leave a copy of them on the place of the screen where they were before ...

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    75

    Arrow + Sprites n allegro

    When moving the sprites they leave a copy of them on the place of the screen where they were before they moved, so finally the screen is full of trash,how can I avoid that?
    ---Programming is like roaming, you never know where you'll end at------

    If 'here' is pronounced as 'hear', why 'there' isnt pronounced as 'dear'??

    paninaro3000@yahoo.com

  2. #2
    Unregistered
    Guest
    This is JoshG, umm, try clearing the screen.

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    75
    isnt there a better way ?
    ---Programming is like roaming, you never know where you'll end at------

    If 'here' is pronounced as 'hear', why 'there' isnt pronounced as 'dear'??

    paninaro3000@yahoo.com

  4. #4
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    Essentially you are going to have to clear the screen, but there is a better way to do so than - clear(screen).

    This example is going to be if you want to use a 640x480 bitmap as your background.

    Code:
    blit(background, buffer, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
    draw_sprite(sprite, buffer, x, y);
    blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
    If you use this as your algorithm for drawing to the screen it will be erasing the old information on the buffer (not the screen), putting the new information on the buffer, and finally putting the buffer information to the screen. This will, also, prevent flickering on the screen by using the buffer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. making sprites
    By DavidP in forum Game Programming
    Replies: 9
    Last Post: 02-20-2010, 07:00 AM
  2. Game Programming FAQ
    By TechWins in forum Game Programming
    Replies: 5
    Last Post: 09-29-2004, 03:00 AM
  3. double buffering for allegro
    By Leeman_s in forum C++ Programming
    Replies: 6
    Last Post: 09-12-2002, 03:45 PM
  4. Special Allegro Information
    By TechWins in forum Game Programming
    Replies: 12
    Last Post: 08-21-2002, 12:35 AM
  5. Sprites n Allegro
    By Paninaro in forum Game Programming
    Replies: 1
    Last Post: 07-07-2002, 10:28 AM

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