• 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] Help with image_angle and collision

T

tamation

Guest
Hi, this is probably a super simple question, but I don't often make top down games that use image_angle, so I need a bit of help with something.

Is there anyway to make it so my player just has a constant square hit box, even when the angle of the sprite is changing? I've tried using masks, but that didn't seem to do anything.
 

Kyon

Member
Yeah, don't use image_angle, but make a separate variable for the image_angle called 'angle' or whatever.
So, somewhere in create
Code:
angle=0;
then in your step, I don't know if you do it like this, but the part where you change the image_angle just make it angle.
so like
Code:
angle=direction;
And now you must draw the sprite using angle as image_angle.
So I recommend to just use (draw event):
Code:
draw_sprite_ext(sprite_index,image_index,x,y,image_xscale,image_yscale,angle,image_blend,image_alpha);
Now your object won't rotate but just the drawn sprite.
So now your mask should work. Just make sure you removed the part where you change your image_angle.
 
T

tamation

Guest
Yeah, don't use image_angle, but make a separate variable for the image_angle called 'angle' or whatever.
So, somewhere in create
Code:
angle=0;
then in your step, I don't know if you do it like this, but the part where you change the image_angle just make it angle.
so like
Code:
angle=direction;
And now you must draw the sprite using angle as image_angle.
So I recommend to just use (draw event):
Code:
draw_sprite_ext(sprite_index,image_index,x,y,image_xscale,image_yscale,angle,image_blend,image_alpha);
Now your object won't rotate but just the drawn sprite.
So now your mask should work. Just make sure you removed the part where you change your image_angle.
Perfect. Amazed I hadn't though of this sooner, thanks!
 
Top