From: "jakub" Newsgroups: comp.os.msdos.djgpp Subject: Sprite "ghost" help please. Date: Wed, 15 Jul 1998 15:18:37 +1000 Organization: OzEmail Ltd. Lines: 83 Message-ID: <6ohq64$jfu$1@reader1.reader.news.ozemail.net> NNTP-Posting-Host: slsdn6p56.ozemail.com.au To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Hi, I'm slowly learning to write my first game. I have a sprite that moves horizontally across the screen controlled by the keyboard. Am using Allegro, with a 640x480 screen, and page flipping. The problem is that when the ship moves, I can see it 'flickering' at the edges. Is there any way to fix this? Snipped code follows: int main(void) { ..... set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 960); /* need virtual page at least 2x size */ ... /* page flipping bitmaps creation */ page1 = create_sub_bitmap(screen, 0, 0, SCREEN_W, SCREEN_H); page2 = create_sub_bitmap(screen, 0, SCREEN_H, SCREEN_W, SCREEN_H); active_page = page2; ..... /* play while esc key is not pressed */ while(!key[KEY_ESC]) { clear(active_page); if(key[KEY_LEFT]) { player_x -= 4; } if(key[KEY_RIGHT]) { player_x += 4; } if(player_x > 594) player_x = 594; /* if player is near right hand edge, ie. player sprite is 43x38 screen is 640x480, 640-43=597, don't let the ship move off screen */ if(player_x <= 0) player_x = 0; /* similar to above but left hand edge this time */ .... missile fire section /* draw the players ship */ draw_rle_sprite(active_page,shoot_datafile[player].dat,player_x,441); if (active_page == page1) { scroll_screen(0, 0); active_page = page2; } else { scroll_screen(0, SCREEN_H); active_page = page1; } } .... destroy bitmaps and exit } -- ------------------------------------------------------------------------