Welcome to the Treehouse Community
Looking to learn something new?
x and y coordinates
I would have set the x-coordinate for the horizontal position and movement (LEFT or RIGHT) and the y-coordinate for the vertical position and movement (UP or DOWN) to be consistent with the standard Cartesian-plane and 2D physics. What do you think?
The standard convention for an xy-coordinate system (Cartesian plane) is that for a given coordinate, the x-value represents the horizontal (left/right) position and the y-value represents the vertical (up/down) position. In the dungeon game, you did the reverse of this convention. It's not a big deal, I just thought I'd mention it.
Kenneth LoveTreehouse Guest Teacher
Ah, you're right. Not sure why I blanked and went with a different scheme. Regardless, so long as the scheme is consistent, it's easy enough to figure out your direction and location.
Feel free to submit a cartesian version!
lol i was going to ask the same thing, to make it easier for me i used Y as the vertical, and x as the horizontal.
never mind i see why you did it that way, i was thinking of it as if the cells were like a graph, but the way the cells are aligned if you want to move left, x would have to - 1. i didn't realize it till i started placing roadblocks where player can not go any further
I programmed a little pong game once where instead of using Cartesian coordinates where (0, 0) is the center of the graph, (0, 0) was actually the upper left hand corner. Even with that method, we used x for horizontal and y for diagonal. Every time we wanted to move something down, we would increase the y coordinate. It was the opposite of the Cartesian method in that regard. I think that's what's happening here, even if the axes are not labeled conventionally. (I'm going to rename them as I work through this codes since my brain doesn't want to accept y as a horizontal axis. Might be easier to call it Steve than to call it y. :-)