HELP!!!!

Started by
1 comment, last by ender7771 18 years, 8 months ago
hi i want to produce a simple program with a black box and a white box that bounces around in the black box but if it hits the sides it bounces back off and goes in a different direction can any one help i know a little c and a little cpp i have the dev cpp compiler and wx devcpp
Advertisement
WX is a GUI interface. Why are you using it to develop games? The only part about it that is game related is that it can set up an OpenGL context. My suggestion is to start out using SDL instead of WX Widgets. It should be in your DevC++ Package Manager (under the tools menu) and when it is done downloading repost your help message with a more descriptive title.

Here's a hint about bouncing off of a box: read the pixel that's at the position the white box will be at before it gets there. If the pixel is black it will have to bounce. If you read one pixel ahead on the x-axis but equal on the y-axis and it's black then you know the x-axis will need to reverse. Likewise if you read one pixel ahead on the y-axis but equal on the x-axis and it's black then the y-axis will need to reverse. If both the previous conditions were clear but the pixel directly in the path was still black then both axes need to reverse since you've hit a corner.
You should learn more C++ or C.

Most graphics libraries (like SDL) make extensive use of pointers, and if you are not comfortable with them you will get lost.

This topic is closed to new replies.

Advertisement