S
Spencer S
Guest
I'm trying to center an inventory sprite onto the camera position, so that the inventory stays on the gui. I don't want to draw the inventory to the gui; I want to draw the inventory to coordinates that are determined every step of the game.
Here is my inventory's create event:
Here is my inventory's step event:
And here is my inventory's end step event:
I'm trying to follow this tutorial https://forum.yoyogames.com/index.php?threads/guide-meet-the-new-camera-system.12269/ and use the code for my own purposes, but as of right now, the inventory isn't showing up at all. Anything wrong with my code?
Here is my inventory's create event:
Code:
topLeftOfCameraXAxis = camera_get_view_x(view_camera[0]);
topLeftOfCameraYAxis = camera_get_view_y(view_camera[0]);
middleOfCameraXAxis = camera_get_view_width(view_camera[0]) * 0.5;
middleOfCameraYAxis = camera_get_view_height(view_camera[0]) * 0.5;
inventoryBackgroundHeight = sprite_get_width(spr_inventory_background);
inventoryBackgroundWidth = sprite_get_height(spr_inventory_background);
Code:
if obj_player.key_menu {
draw_sprite(spr_inventory_background, 0, ((topLeftOfCameraXAxis + middleOfCameraXAxis) - (inventoryBackgroundWidth / 2)), ((topLeftOfCameraYAxis + middleOfCameraYAxis) - (inventoryBackgroundHeight / 2)));
}
Code:
topLeftOfCameraXAxis = camera_get_view_x(view_camera[0]);
topLeftOfCameraYAxis = camera_get_view_y(view_camera[0]);
middleOfCameraXAxis = camera_get_view_width(view_camera[0]) * 0.5;
middleOfCameraYAxis = camera_get_view_height(view_camera[0]) * 0.5;