I have a sprite, sDetritus
, with a corresponding object, oDetritus
, and an sTurret
and oTurret
.
If I apply no rotation (i.e. changing the image_angle) to oDetritus
, I can anchor the oTurret
to a specific position on the ODetritus, using its sprite as a guideline. In this case, the desired x and y for the oTurret
, in relation to the oDetritus
's x and y origin, are x - 37 and y + 192.
I can make the oDetritus
the Owner
of the oTurret
, and make sure that the oTurret
'sticks' with the following in its Step event:
if instance_exists(Owner) {
x = Owner.x - 37
y = Owner.y + 192
}
However, how would I adjust this to account for rotating the image_angle of the oDetritus
object underneath? Obviously then the x and y values would be wrong. I have tried using lengthdir_x
and lengthdir_y
, but this doesn't seem to be the correct function here.