Mail Archives: djgpp/2000/08/04/06:45:48
Newsgroup: comp.os.msdos.djgpp
From: manni DOT heumann AT gmx DOT de (Manni Heumann)
On Fri, 04 Aug 2000 08:01:13 GMT
>>if (sprites_collide(sprite1, sprite2))
>> do_mega_big_explosion();
>>
>
>
>Ok, I can see that. But what you have here is an example of
>how easy programming can be if you use exceptionally good
>libraries like Allegro. All you have to supply to that
>function are two tiny arguments, that already contain all
>the information you will need in that function. But often
>you will find yourself passing endless arguments back and
>forth.
Allegro doesn't know about sprites or collison detection, it knows
about bitmaps. My snipped of code assumes *you* made a function to
check for collision detection and created a sprite structure.
My point is that in writing your code, you should try to make it so
that things like this are possible. This can be easily done by using a
struct for storing all the sprite data.
>Can we settle on this: Generally discouraging the use of
>goto would be going to far, just like demanding a goto in
>each and every case of breaking out of a nested loop.
Partially; It is my opinion that you should always try to look for
alternatives to goto, because it is my experience that they make your
program more readable and easier to maintain later on. Still, if there
are no other solutions, use it. I think my advise would be: try other
things first, use goto with care.
Regards,
Evert Glebbeek.
- Raw text -