[SOLVED] Help with image_angle and collision

tamation

Member
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.
 

tamation

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.
Perfect. Amazed I hadn't though of this sooner, thanks!
 
Top