Allegro tile program not working

Started by
1 comment, last by copper103 14 years, 5 months ago
this is the code: #include <allegro.h> int map[18][10]={{0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0},}; void setupgame(){ for(int i=0;i<=10;i++) { for(int t=0;t<=18;t++) { if(map[t]=0)rectfill(screen,i*20,t*20,(i+1)*20,(t+1)*20,makecol(255,0,0)); } } } int main(){ allegro_init(); install_keyboard(); set_color_depth(16); set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0); setupgame(); while( !key[KEY_ESC]){ } return 0; } END_OF_MAIN(); The debugger shows no errors, but when I run it the screen goes black and nothing happens. Why?
Advertisement
Change if(map[t]=0) to if(map[t]==0), in setupgame. Comparison needs two equal signs.
Quote:Original post by Erik Rufelt
Change if(map[t]=0) to if(map[t]==0), in setupgame. Comparison needs two equal signs.


thanks a lot, i didnt see that, it works now.

This topic is closed to new replies.

Advertisement