Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | KiraArts |
Hello, a little large cuestion.
I want to do a targen/bullseye with points for each circle, like the little one, give 300, the second 200, the other 100 and the bigger one 50, but i’m not sure how to do that.
The image:
https://www.mediafire.com/file/sak6zorqclv32qn/godotdiana.PNG/file
I made a sprite for each circle and put this code:
func _input(event):
if event is InputEventMouseButton and event.pressed and event.button_index == BUTTON_LEFT:
if get_rect().has_point(get_local_mouse_position()):
if event.pressed:
P200 = true
Print("300")
else:
print("Not pressed")
and it works, when i press the center circle, it prints “300”, but also “200”, “100” and “50”. when I press the second one, it prints “200”, “100”, “50” (I only want 200).
How can I get only one number?
I tried with signals:
emit_signal(“click200”)
and this code in the node2D:
p300 = false
p200 = false
p100 = false
p50 = false
with each signal, changes with true (emit_signal(“click300”), in the node2D: P300 = true)
if P300 == true:
print("300")
p200 = false
p100 = false
p50 = false
And this with p200, p200 and p50.
The problem is that the first time, always prints “50”, and, if I press 200, it prints “200”, ok, but if I press any other, it will print “200” again.
Any one have the solution or another method?
Thanks.