I
ImBored
Guest
I am having an issue with my collision masks. Everything was working fine until I added code to make the game scale based on the screens resolution.
I have a post-draw event that has the following code:
I'm showing this because I feel like it is something to do with the way gamemaker scales objects.
I have a grid of objects. My collision code is in the step event and is:
The problem is that the collision masks are seemingly enlarged but slowly get smaller until the center object in the grid. The center objects mask is working perfectly but all the rest are enlarged for some reason. In the image, the red square is the object that is "colliding" with the mouse.
Edit:
I have done some more testing and found that it probably has something to do with drawing the application surface.
The next picture shows what happens if I draw squares around the bounding boxes using the following code:
The orange squares are being drawn where they should be but it isn't where the actual collision ends up taking place so something must be happening before I draw or my application surface is moving when being drawn but my collision masks aren't. The orange squares just show the boundaries of the collision masks, I'm using a sprite that is a rectangle shape similar to the actual grid shapes and so it is at an angle. It is also set to precise.
I have a post-draw event that has the following code:
Code:
draw_surface_ext(application_surface, XOffset, YOffset, Mult, Mult, 0, c_white, 1);
I have a grid of objects. My collision code is in the step event and is:
Code:
if (position_meeting(mouse_x, mouse_y, self))
Edit:
I have done some more testing and found that it probably has something to do with drawing the application surface.
The next picture shows what happens if I draw squares around the bounding boxes using the following code:
Code:
draw_rectangle(bbox_left, bbox_top, bbox_right, bbox_bottom)
Attachments
-
15 KB Views: 1
Last edited by a moderator: