Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: .  (Read 2957 times)

0 Members and 1 Guest are viewing this topic.

Helios101

  • Newbie
  • *
  • Posts: 15
    • View Profile
.
« on: January 24, 2014, 06:01:20 am »
.
« Last Edit: May 03, 2018, 05:25:17 am by Helios101 »

Azaral

  • Full Member
  • ***
  • Posts: 110
    • View Profile
Re: Making a tilemap with a 2D array.
« Reply #1 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();

G.

  • Hero Member
  • *****
  • Posts: 1590
    • View Profile
Re: Making a tilemap with a 2D array.
« Reply #2 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?

G.

  • Hero Member
  • *****
  • Posts: 1590
    • View Profile
Re: Making a tilemap with a 2D array.
« Reply #3 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

AN71

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Making a tilemap with a 2D array.
« Reply #4 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.
Quote from: Friedrich Nietzsche
He who would learn to fly one day must first learn to stand and walk and run and climb and dance; one cannot fly into flying.

 

anything