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

GameMaker Collision mask rotation connected to player rotation

W

Wyatt Putman

Guest
hi, i'm quite new to game maker (started 3 weeks ago), i am making a simple top down shooter game

i worked out the collision and every thing works but the only problem is when i rotate the player the player gets stuck in the walls (the player is a circle), so i thought if i made a smaller circle (that does not rotate) and use that as the collision mask for the player. however it would make the player slightly go into the walls when it rotates but i don't care.

but the thing is that the smaller circle i am using for the collision mask rotates while the player rotates. i want the collision mask to not rotate and the player sprite can rotate on it's own.

if anyone can help me that would be awesome (i use Game Maker Studio 2)
 

YoSniper

Member
You can use a square mask for the player object.

Then, to make the player appear to rotate (and fire in those directions and whatnot,) you can have an angle attribute that you set in the Create Event and manage with your code.

As long as you don't change image_angle the mask won't rotate at all.

To accomplish this, in your Draw Event, you would have something like this:
Code:
draw_sprite_ext(sprite_index, image_index, x, y, image_xscale, image_yscale, angle, c_white, image_alpha);
This would draw the player facing the appropriate angle, but the mask of the player object would still be an upright square.
 
Top