I have an object with its own inventory, for which I use a list of maps. Each item has a name and x and y offsets.
I want to draw each item with its offset on top of my other object, and have them turn along with the original object, so inside the draw function I have this:
draw_sprite_ext(spr_cart2, 0, x, y,1,1,direction, c_white, 1)
for(i = 0; i < ds_list_size(products); i++){
product = products[| i]
rad_dir = degtorad(direction)
x_rot = cos(rad_dir)*(product[? "x"]-x) - sin(rad_dir)*(product[? "y"]-y)
y_rot = cos(rad_dir)*(product[? "y"]-y) - sin(rad_dir)*(product[? "x"]-x)
draw_sprite_ext(asset_get_index("spr_"+product[? "product"]), 0, x_rot, y_rot, 1, 1, direction, c_white, 1)
}
However, it doesn't work at all. I tried logging product[? "x"]-x, and it gave a very large negative number, whereas logging just product[? "x"] did give the expected result.