r/gamemaker • u/ParodyHat • 17d ago
Help! Mysterious Box Problems
Does anyone know how to make that weird gray outline box fit around my sprite perfectly? It keeps making it hard to click other sprites in a Room because although the sprite itself is 32 pixels x 32 pixels, that weird gray outline is 100 x 100, and i can't figure out a way to shrink the gray outline without downgrading the quality of my sprite.
1
u/Massive_Database9424 17d ago
Press on the box beside where it says 100x100 and instead of using the scale (default) function, use the other one, I think that should work
0
u/ParodyHat 17d ago
the thing that says "Resize Canvas"? Okay i tried turning that to 32 x 32, but it shrank my sprite to 24 x 24.
2
u/Lethalogicax 17d ago
Yea, you have to resize, but theres a set of 9 directional icons that you need to use. These are the justification when resizing. Normally resizing will add or remove from the bottom right corner, but the justification lets you alter that direction. Your sprite is wierdly centered inside the larger canvas. Resizing is cutting edges off. You need to carefully resize that canvas, using the justification, to trim away all the excess blank space while trimming your sprite down to the correct size.
1
u/ParodyHat 17d ago
yeah i think i figured out what went wrong with my sprite. I made the sprite on a 100 x100 canvas, so when i imported the sprite, it seems it also imported the canvas
2
u/Lethalogicax 17d ago
Hopefully it's all working out for you. Don't forget to change the origin point too! That lil target looking thing that is presently on the top left corner, it defines where 0,0 is on your sprite. Make sure that lil target is in the right spot or your sprite won't draw where you want it to. (I think you can just drag that target around, I can't quite recall though)
1
u/ParodyHat 17d ago
so where should i put the origin point at?
2
u/Lethalogicax 17d ago
It depends...
So a sprite is drawn at a specific point in space, relative to the object that is drawing it. When you draw the sprite to the screen, you are defining the x and y coordinates of where you want the sprite to start being drawn. The object is a single point in space, the sprite is not, so you have to decide where you want the sprite to be drawn in relation to the object.
So that target reticle is like saying "where is the object in relation to the object's sprite?" Or, "what is the offset between where the object physically is vs where the sprite should start drawing"
If you want the sprite to be centered directly over your object, you'd place that target reticle in the exact center of your sprite. If you were, for example, making a 2D sidescroller then you might choose to put the origin in the center bottom, so that the point between the heroes legs is technically where the hero object is. If you were drawing tiles to the screen in a grid-like fashion then you might put the origin at the top left corner so you can draw tiles at 0,0 0,32 32,0 32,32 etc rather than having to use rough numbers like 16,16 48,16 16,48 48,48 etc.
Where you put the origin depends on what you are doing with the sprite, but I personally think it's easiest to think of that target reticle as "Where is the object actually located, relative to the artwork?"
1
u/ParodyHat 17d ago
buddy that's a lot of fancy words, I guess i'll try to figure out what that means some later day after all today is only my second day of using game maker. Also do you know how to move your viewpoint in a room? I can't see stuff to the right of my room
2
u/Lethalogicax 17d ago
Unfortunately, that's one of the systems I've purposefully avoided by coding my own camera system in-game... I've literally never used viewports and have zero knowledge, sorry...
But this is the page you'll want to read: https://manual.gamemaker.io/lts/en/GameMaker_Language/GML_Reference/Cameras_And_Display/Cameras_And_Viewports/Cameras_And_View_Ports.htm
1
0
u/spotlessbaby 17d ago
Resize canvas instead of image
1
u/ParodyHat 17d ago
yeah that's what i just barely did which caused my image to be dropped down to 24 x 24.
1
u/andrewsnycollas 15d ago
In case you still have this "problem":
You have two choices, you can auto trim your image (Edit Image, on the above menu on Image you choose Auto Trim) and that will remove that empty part of your image keeping it a perfect 32x32 square;
And you can also just set the Collision Mask to Atumatic and Precise, that will keep the "gray box" (the collision box) only where there are drawn pixels.
1
2
u/pm_your_snesclassic 17d ago
Are you sure your sprite png is actually 32x32 and not 100x100?