> What's the problem with my code? Lack of commenting? Indention? Variable names?
I've always find it quite difficult to read code where '{' is in the end of the line:
Code:
if (key[KEY_DOWN]) {
if (ry < 450) {
ry += 30; rest(100);
}
}
Though this is only my opinion, I just find that
Code:
if (key[KEY_DOWN])
{
if (ry < 450)
{
ry += 30; rest(100);
}
}
And even better is to ditch 'em all if not needed:
Code:
if (key[KEY_DOWN])
if (ry < 450)
ry += 30; rest(100);
About the general structuce of your code...
First of all, big functions tend to be somewhat... well, nobody just doesn't like 'em :-)
o Perhaps making an init-function where you start allegro, install mouse/keyb, etc.
o Maybe handling the initialization of `world' in a function of it's own?
o ...and input in some specific function?
Anyway, since I haven't compiled allegro to any Windows-compiler and having to convert your source to fit DJGPP (removing END_OF_MAIN, default_palette -> desktop_palette, GFX_AUTODETECT_WINDOWED -> GFX_AUTODETECT, removing set_window_title()) it crashed immediatly after running it (and since I'm online with a modem I don't have the time to debug it now...)