View Full Version : Please try out some of my programs by downloading.

Golden Bunny
07-01-2002, 10:59 PM

This page contains a list of all the programs I have made using C/C++/SDL. Enjoy!!

07-02-2002, 12:06 AM
your collision detection program needs some work on the right side

Golden Bunny
07-02-2002, 09:06 PM
I know, I coded it right. I don't know why it keeps being invisible. For you SDL programmers, can you see whats wrong with my SDL_Collision program?

07-02-2002, 09:53 PM
First off, you need a better coding style.
Here are a couple of hints to get you started:
1. Make your variable names (and class names) meaningful; not uno, dos, r1, r2, ZooClass, etc.
2. Make your function names meaningful (why you picked SimpleGift is beyond me ??? ).
3. Comment you code!

Basically, use a style that makes your code 'readable'. Another programmer shouldn't have to try and figure out what you're trying to do.

You also had some errors in the code I downloaded, like a line in your Collision() function:
dos.x+20; // doesn't do anything, guessing you need an '='

I haven't looked into your collision detection but my first guess would be you forgot to add the width in your calculation when testing the right side of the blue square (easily fixed).

Get your hands on a copy of "Code Complete" by Steve McConnell. Go to a bookstore or library or something, but read the book.

/* edit: and catch the SDL_QUIT event type so you can close the application by killing the window. */

Golden Bunny
07-03-2002, 09:16 AM
I fixed it now, I complete changed the source code around. I used a more simplier function, but yet the program's size is smaller but does the job.