L
Louise112
Guest
So I'm creating an isometric city builder type game and am fairly new to GML and programming so am trying to start small.
To start with I've created a simple map and an objects that draws a tower sprite button to the GUI layer.
When in game the player can move the camera around the map using the arrow keys and what I want to have happen is for the player to be able to click on the GUI tower button and have a tower appear at the mouse position for them to be able to place.
If I place the tower button on the map directly I can click on it and place a tower. Success! But if I draw the sprite to the GUI layer I can't click it at all. The problem with this solution is that the GUI button doesn't follow the player when they move to a different part of the map.
The closest I've gotten to a solution is the function -> device_mouse_x_to_gui(0) which shows me the x/y value of the mouse relative the the GUI. But asides from manually entering in the sprite box on the GUI and checking for a match I'm not sure how to get GUI layer sprite buttons working.
I've also tried adding in the step event to let the x position equal the camera position but the button seemed to lag and jump around a lot -> x/y=camera_get_view_x/y(view_camera[0])
Would love any idea's or suggestions? any tutorials or points in the right direction would be great!
Thank you in advance!
To start with I've created a simple map and an objects that draws a tower sprite button to the GUI layer.
When in game the player can move the camera around the map using the arrow keys and what I want to have happen is for the player to be able to click on the GUI tower button and have a tower appear at the mouse position for them to be able to place.
If I place the tower button on the map directly I can click on it and place a tower. Success! But if I draw the sprite to the GUI layer I can't click it at all. The problem with this solution is that the GUI button doesn't follow the player when they move to a different part of the map.
The closest I've gotten to a solution is the function -> device_mouse_x_to_gui(0) which shows me the x/y value of the mouse relative the the GUI. But asides from manually entering in the sprite box on the GUI and checking for a match I'm not sure how to get GUI layer sprite buttons working.
I've also tried adding in the step event to let the x position equal the camera position but the button seemed to lag and jump around a lot -> x/y=camera_get_view_x/y(view_camera[0])
Would love any idea's or suggestions? any tutorials or points in the right direction would be great!
Thank you in advance!