This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Iredstone7648's profile picture

Circle Generator and Click Detector

Started by Iredstone7648, 19 February 2017 - 03:09 PM
Iredstone7648 #1
Posted 19 February 2017 - 04:09 PM
Hello Everyone,

I am currently working on a game and need some help. I want to make a circle generator that has click detection. Basically I will use something like:



drawCircle(25,8,5) --(x,y,radius)

local event,button,X,Y=os.pullEventRaw("mouse_click")
if in_circle(25,8,5,X,Y) then --(x,y,radius,ClickX,ClickY) return true if ClickX and ClickY are in the circle, otherwise return false
    --do stuff
end

Anything similar is fine. Thanks for helping!
Lyqyd #2
Posted 19 February 2017 - 04:41 PM
What part of this are you stuck on?
Iredstone7648 #3
Posted 19 February 2017 - 04:46 PM
I made a few attempts but none worked correctly. I could draw a circle but couldn't get any clicks to register.
Lyqyd #4
Posted 19 February 2017 - 04:55 PM
We can't help fix your code unless you post it, of course. Where's your latest attempt at click detection?
Iredstone7648 #5
Posted 19 February 2017 - 05:20 PM
Never mind, I actually found the solution and it works great. Thanks for your support!