# I made my own collision detection code

I made a collision detection code:

```
init = function()
posdistx = sqrt(mouse.x-0)
posdisty = sqrt(mouse.y-0)
negdistx = sqrt(0-mouse.x)
negdisty = sqrt(0-mouse.y)
end
update = function()
posdistx = sqrt(mouse.x-0)
posdisty = sqrt(mouse.y-0)
negdistx = sqrt(0-mouse.x)
negdisty = sqrt(0-mouse.y)
end
draw = function()
screen.clear("rgb(0,0,0)")
screen.fillRect(0,0,50,20,"rgb(0,255,0")
if negdistx <= 5 then
if posdistx <= 5 then
if negdisty <= 3 then
if posdisty <= 3 then
screen.drawText("hit"0,0,20,"rgb(255,255,255")
end
end
end
end
end
```

Will I ever use this, maybe.