• Advertisement
Sign in to follow this  

Allegro tile program not working

This topic is 3031 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement