I want to get the side of a square another object collides with.
Heres what I've tried:
solution 1:
int hdis = (other.x - x); int vdis = (other.y - y); if (abs(hdis) < abs(vdis)) { if (hdis > 0) room_caption="right"; else room_caption="left"; } else { if (vdis > 0) room_caption="bottom"; else room_caption="top"; } solution 2:
int dir = (point_direction(x,y+sprite_get_width(mask_index)/2,other.x,other.y) / 90); both are horribly inaccurate. Any way to do this better?
|