Would this be possible? For example: when a button is pressed, it uses image:get() to find the color of the pixel at whereverX,whereverY. I’ve tried, but no matter what I try, it always gives an error. Any help is VERY appreciated!
Hi @CodeaNoob
Is this what you’re looking for ?
-- Camera
displayMode(FULLSCREEN)
-- Use this function to perform your initial setup
function setup()
-- Start using the front camera
cameraSource(CAMERA_FRONT)
spriteMode(CORNERS)
capturedImage = nil
camWidth = 0
camHeight = 0
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
-- Get the size of the current camera texture
camWidth, camHeight = spriteSize( CAMERA )
-- Draw the special CAMERA sprite
sprite( CAMERA, 0, 0, math.min( camWidth, WIDTH ) )
if capturedImage ~= nil then
if CurrentTouch.x < camWidth and CurrentTouch.y < camHeight then
local r, g, b = capturedImage:get(CurrentTouch.x, CurrentTouch.y)
text(r .. ", " .. g .. ", " .. b, 200, HEIGHT - 50)
end
end
end
function touched(touch)
capturedImage = image(CAMERA)
end