• 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!

(SOLVED) draw_rectangle changes size, in spite of the variables never changing

M

MagnumVulcanos

Guest
GIF.gif
As you can see in the gif, I have made myself a pretty cool map.
Every map entity ahs the following:
color, size, and position (x, y).
The size is used as follows when drawing the rectangle:
Code:
draw_rectangle(x-size,y-size,x+size,y+size,true);
The problem is, as you can see in the gif, that the rectangle changes shape, and sometimes gets drawn smaller (vertical or horizontal) what's going on with that?
Is there a reliable method of drawing a dot on the screen? Should I just draw a sprite and scale it instead?
 
M

MagnumVulcanos

Guest
Make sure to round your coordinates when drawing. Otherwise, things may end up being just a bit off.
floor(whatever) should work right?
Tried flooring my original coordinates and it didn't work. I am doing a calculation within the draw event, should I not do this?
 

TsukaYuriko

☄️
Forum Staff
Moderator
floor(whatever) should work right?
Flooring should work if drawing at fractional coordinates is the source of the problem. Since it doesn't, this may not be the cause, or there may be other causes. Is there any type of scaling going on, such as zoom effects or drawing the view port to the screen at a different resolution than the view itself?

Tried flooring my original coordinates and it didn't work. I am doing a calculation within the draw event, should I not do this?
Whether you should be performing calculations in the Draw event depends on what the results will be used for.
If they are only used in the corresponding Draw event, it's perfectly fine.
If it's used anywhere else, it might mess up timings if your game logic and draw frame rates are not identical, which can have all sorts of strange, yet sometimes hilarious, side effects - so you shouldn't do it in that case.
 
M

MagnumVulcanos

Guest
I'm drawing onto the gui layer, and as far as scaling goes, I'm doing nothing nothing. I've replaced the icons with sprites, which seems to have "solved" the problem, no idea why it doesn't work though.
Using circles leads to the same result, the circles may appear as ovals at times.
 

TheouAegis

Member
Maybe the GUI's surface needs to be resized, but I'd expect just being squished from top to bottom, not from left to right also.

In your formula, what is size?
 
M

MagnumVulcanos

Guest
Maybe the GUI's surface needs to be resized, but I'd expect just being squished from top to bottom, not from left to right also.

In your formula, what is size?
I solved it, scaling works very weirdly in gamemaker, I set all camera and port sizes to my screen size, but the window border is apparently the port screen, the issue disappears when I set the game to fullscreen, but without this, scaling is weird.
 
Top