Need help connecting Canvas.DrawCircle value to a global variable

Hi, I'm new but I'm trying to store a circle object in a variable and I cannot figure out how to do it. I've created a global variable called circle and am trying to draw a circle at a random coordinate.

Hi. Could you explain the problem a bit more, because I don't quite understand.

I believe you will need to draw the circle point(degree) by point around the circumference, and record each of these points(x/y) in a list to your variable. Then you can reapply that list of points to the drawShape block.

Or simply store the x/y, radius, fill parameters to a variable, then return these to a drawCircle block when needed.

This sample generates a bunch of them and stores them in a list.

On the left draw circle and save variables, on the right fetch variables and draw circle

Sorry, I’m trying to create an aim trainer app in which the user touches a circle and if their touch is inside the circle, their hit value goes up +1.

I don’t know how to get the coordinates of the circle and compare if the coordinates of the user’s touch are equal

Well, that is a completely different question!

1 Like

Oh sorry :joy:

Use the Canvas.Touched event to get the x,y and use the Pythagorean Theorem to see if it is within the radius of circleX,circleY.

Or use a Ball for the circle, and use the Ball.touched event.

1 Like