• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Confused about seemingly different (0, 0) point

Baldi

Member
show2.png
As you can see in the image, the grid and the tiles are misaligned (by exactly one pixel). The camera's X and Y position is exactly at (0, 0) when the screenshot was taken - the same place at which the first tile is drawn, so that makes sense. However, also the lines of the grid are coded to start at that (0, 0) location, but they seem to be starting at (1, 1). At first I just thought I did some little mistake when drawing the grid, however, the quarter circle that you can see in the top left corner in the picture is drawn at (-1, -1), so something is wrong...

The view x and y coordinate is constantly clamped to 0 when the picture was taken, so it must be the right (0, 0) point (which makes sense since the tiles agree). But in a different script, executed just after drawing the tiles, I literally just say draw_circle(0, 0, 1, false) and it is one pixel misaligned!

It is as if both codes have a different (0, 0) point... Can someone help?
 

Baldi

Member
Since I don't know what that is I do not. Im very sure by now that the grid is showing the true (0, 0) point, but there is just no way the camera is not at (0, 0) since that is where I put it... At the moment I have it "faked" by actually limiting the camera to (1, 1) and adding 1 to the x and y positions of the tiles, that makes it at least seem perfect.

EDIT: Nevermind, I am now looking at mouse_x and mouse_y and it says that the true (0, 0) point is where the pink dot is in the picture. However it is drawn at (-1, -1)! Very confused...
 
Last edited:

Baldi

Member
Okay so I don't know why it took me so long but now I literally did this in a code:
draw_set_color(c_red)
draw_rectangle(0, 0, tile -1, tile -1, false); //tile is 16
draw_set_color(c_yellow)
draw_point(0, 0);

and this is the result:
show3.png
the tiny yellow dot (sorry) is a point at (0, 0) and the red rectangle starts at (0, 0) as well. So this is normal? At first I thought, drawing a rectangle just ads an outline of 1 (since the rectangle also has to be tile -1, tile -1 to fit perfectly) but that wouldn't explain why the camera, positioned at (0, 0) is also exactly where the rectangle starts...

EDIT: It basically looks like draw_line and draw_point just are wrong by +1 to both x and y
 
Last edited:
Top