Sign in to follow this  

Strange bug in my code

This topic is 3098 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

I'm making a tetris clone but I have a strange bug in the code (please download it at http://igpgames.altervista.org). My problem is the tetraminos is not showing and moving right and I don't know why. Thanks in advance for any help. Bye, Berserk. .

Share this post


Link to post
Share on other sites
You may want to present your problem better to get any help. Currently your post read like this: "I have a bunch of code, it doesn't work, please fix it". Perhaps you didn't mean to sound like that, but that's pretty much what I read.

In order for people to assist you, you may want to consider doing the following:
  • Instead of providing the entire code base, isolate or even generalize the problem. Place break points, trace and analyze debugger output or reduce the project to its bare essentials. This often gives you more insight into the problem.

  • If you're still stuck, post the relevant parts of your code using the source tags and provide a short but meaningful description of the classes, functions, variables etc. and how they relate to each other. Sometimes just adding some comments to the code already suffices. If it's unclear from the context, specify what language/frameworks/libraries etc. you're using.

  • Tell us what the code should do if it worked correctly, and what it currently does. In case of graphical 'errors', screen shots might help too.

  • If you have some idea of what the problem could be, gives us your opinion.

Share this post


Link to post
Share on other sites
I don't have a clue on where the bug is, this is why I provide the entyre source.
The source is commented in the headers with short explanations on what variables and methods of my classes do.
I think the problem is in tetraminos::draw because the tetraminos is not drawn correctly while the playground grid is, but I can't do any debug because I don't know where visual studio 2003 places the executable when I press play and I need a bitmap to be on the same path.
Otherwise all I get is a black screen.
I also noticed some problems moving the only block of the tetraminos appears on the screen and sometimes the falling tetraminos fills the grid playground.
I really don't have a clue of what could be producing the bug and believe me, the only way to notice how strange is is seeing personally.
I'm using the allegro library (version 4.2.2).
The fact is, the code seems well written. Other persons sayd me the code is well written and to my eyes there's nothing wrong. I need more expert eyes.
Thanks in advance for any help.

Bye, Berserk.
.

Share this post


Link to post
Share on other sites
The point is that noody here has the time to do the work you should do to come uü with an actual problem. Running the Visual Studio Debugger just takes a blink of an eye. It also takes care of setting the correct path to load your files from. In case you cannot load resources when running from Visual Studio you need to revise your loading routine to make it more intelligent.

Basically, your problem seems to be that something does not render. So no need to read all of the source code. Before starting asking questions here debug (or if you are not able to do that: write to a log file) what you are trying to render to make sure the render device is in a correct state (read: has the correct transformation) and that your data you want to render is valid such as having the correct positions to start with.

Share this post


Link to post
Share on other sites
Quote:
Original post by Thc-03_Berserk
I would already done a debug if I knew where visual studio places the executable in debug mode. Please download the source and tell me if is there something wrong.


Luckily you don't need to know where it is as just pressing the "start debug" button in the VS IDE will find it for you. Just make sure you aer compiling the debug version. I recommend putting a bunch of breakpoints where you *think* the problem may occur and checking the status of your variables in those places as the program runs.

Share this post


Link to post
Share on other sites
Try, if all else fails, a Find Files and Folders search with the name of the executable. This is the easy part. But try to help us help you. I don't use Allegro, but I could help if I knew what exactly was wrong. Try commenting out lines, changing values, anything to try to narrow down the problem's location. As it stands, I can't be bothered to hunt through other people's source tree while I have my own projects to work on.

Share this post


Link to post
Share on other sites

This topic is 3098 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this