SFML community forums

Help => General => Topic started by: Helios101 on January 24, 2014, 06:01:20 am

Title: .
Post by: Helios101 on January 24, 2014, 06:01:20 am
.
Title: Re: Making a tilemap with a 2D array.
Post by: Azaral on January 24, 2014, 06:23:44 am
Well first thing I see wrong is at the end. You need to call window.clear() before you draw anything. Then when you are done drawing everything, you call window.display();
Title: Re: Making a tilemap with a 2D array.
Post by: G. on January 25, 2014, 01:20:55 am
Your code looks ok, but isn't complete so we can't test it or notice if something is wrong in the portion of code you didn't show.
What doesn't work? What happens that should not happen? What is displayed? Is there any error?
Title: Re: Making a tilemap with a 2D array.
Post by: G. on January 25, 2014, 02:34:37 am
        for(int i = 0; i < MAP_HEIGHT; i++)
        {
            // Index the first column
            for(int j = 0; j < MAP_WIDTH; i++)
In the j loop, you're doing i++ instead of j++
BTW you should only have one clear and one display in your game loop. For example: clear, process events, draw things, display
Title: Re: Making a tilemap with a 2D array.
Post by: AN71 on February 03, 2014, 06:37:47 am
Just wondering, is the counter variable for debugging or just not being used within the scope of your posted code? Right now it seems to be useless code. I apologize in advance if my question seems foolish or if I missed something.