Xer0botXer0
Senpai
Goal: Create a clickable object that displays the players gold, draw it on screen and have it follow the view.
What I tried: I created the object, assigned it a sprite, used draw_text to draw the gold value into the sprite inside the DRAW GUI event.
Problem: The object appears to follow the view as I pan around, but the object is not clickable.
Code:
Step Event:
Draw GUI Event:
Draw Event:
Debug: I used draw_text to print the objects x/y coodinates onto screen.
Finding: The objects x/y coordinates do not change when the view is moved around even though the sprite follows.
What I tried: I created the object, assigned it a sprite, used draw_text to draw the gold value into the sprite inside the DRAW GUI event.
Problem: The object appears to follow the view as I pan around, but the object is not clickable.
Code:
Step Event:
GML:
if distance_to_point(mouse_x,mouse_y) < 1
{
if mouse_check_button_released(mb_left)
{
dollar += 15;
}
}
GML:
draw_self();
draw_text(x + 28,y + 8, string(dollar));
GML:
///this comment in the draw event removes a ghost copy of the sprite.
Finding: The objects x/y coordinates do not change when the view is moved around even though the sprite follows.
Last edited: