Hello! So I am triyng to make a map game, and I need help with map functionality. Hod do I do map with countries, when clicked opens menu that is different for all nations?
I really appreciate any help as I am realky passionate about this project.
Thank you.
We use an Area2D which enables input event detection through its collision shapes.
extends Area2D
func _input_event(viewport: Viewport, event: InputEvent, shape_idx: int) -> void:
if event is InputEventMouseButton and event.pressed:
var oid = shape_find_owner(shape_idx)
var own = shape_owner_get_owner(oid)
print(own.name)
The above code will print “Washington”, “Oregon”, and “California” when their associated shapes are clicked.