Having a moveable button(SOLVED)

Im new to gamemaker and im working on a team and we are making a sort of base survival game and i want the player to have buttons that they can press for structures and i want the buttons to move with the camera currently the camera follows the mouse. this is the current code but it kind of lags behind

x = (camera_get_view_x(view_camera[0]) + 45);

y = (camera_get_view_y(view_camera[0]) + 580);
 
Last edited:

TsukaYuriko

☄️
Forum Staff
Moderator
You may be updating its position before the camera's view moves. Move it after the camera's view moves, in the End Step event. Or use the Draw GUI event to draw to the GUI layer rather than relative to the room.
 
You may be updating its position before the camera's view moves. Move it after the camera's view moves, in the End Step event. Or use the Draw GUI event to draw to the GUI layer rather than relative to the room.
this code is in the object itself which is placed in the room putting it in the end step didnt work
 

TsukaYuriko

☄️
Forum Staff
Moderator
Then please describe the problem in greater detail. What does "it kind of lags behind" describe? Could you show us this lag in action? How does the camera move? What's the code that makes it move?
 

TsukaYuriko

☄️
Forum Staff
Moderator
I can't really tell what's going on based on a static image and no code. That would have to be an animated one and all relevant code. ;)
 
Top