Edit: I wrote this answer then noticed your 3D tag. Is this for 2d or 3d? Anyway leaving the answer for now.
[see end comment re the code samples]
Create the circle sprite--create a PNG and drag it into your project. Make a scene with a Node2D as the root and your sprite as child.
Instance this node into your 'Main' scene at the mouse position when the mouse is clicked on the first point (in _input
with InputEventMouseButton
. Position is event.position
).
Have a field var circleNodeScene
in your Main script
and put this in _ready
:
circleNodeScene = ResourceLoader.Load("res://CircleNode.tscn")
Instance them with var circle = circleNodeScene.Instance()
When they click the second point use a Line2D
(either add it to your Main scene in the editor or create it in code and add_child()
to your main scene) and draw it constantly as the mouse moves (e.g. in _process
) between the 2 points. As they move the mouse, draw the circle sprite/node at the mouse position.
When they click again just stop updating that circle's position and instance a third circle sprite/node at the mouse position. Then switch from drawing a line to drawing a triangle instead. (You'll need a CanvasItem of some kind to draw on, whereas the Line2D was a node and didn't require it.)
When they click the third time, remove (queue_free
) the circle sprites and your triangle remains. Can do the same for rectangles, circles.
Just some ideas for you. I use C# so consider my code samples pseudocode. Just use as a guide.