Ok im having a go at making a little... thing in allegro after reading a few tutorials, so im a complete n00b.
This program is basicly ment to make a drawn circle move around the screen but insted it draws line because it's not erasing the old circle before drawing the new one... how do i fix this so there is only a cicle drawn on the screen at a time?
Cheers ~Matty-Alan~
Code:#include <allegro.h> int POSx = 320, POSy = 240; BITMAP *buffer; void DrawChar(int Cx, int Cy) //THIS FUNKTION HANDELS DRAWING THE Circle { acquire_screen(); circlefill(screen, Cx, Cy, 1, makecol(255,255,255)); draw_sprite( screen, buffer, 0, 0); release_screen(); } END_OF_FUNCTION(); void MoveChar(void) //THIS FUNKTION HANDELS Circle MOVEMENT AND PERMISSABILTY { if( key[KEY_UP] && POSy > 1) POSy--; else if( key[KEY_DOWN] && POSy < 640) POSy++; else if( key[KEY_LEFT] && POSx > 1) POSx--; else if( key[KEY_RIGHT] && POSx < 480) POSx++; } END_OF_FUNCTION(); int main() { allegro_init(); set_gfx_mode(GFX_AUTODETECT,640,480,0,0); install_keyboard(); set_color_depth(16); while(!key[KEY_ESC]){ MoveChar(); DrawChar(POSx,POSy); rest(10); } } END_OF_MAIN();



LinkBack URL
About LinkBacks



