Camera picture as sprite

Hey guys, I’m just working on an “connect four” or “four in a row” game that I have to make for an school project.
And I had this Idea of taking an picture from the player with the front camera and place this picture you take (right into the game) on the stone the player should set ( something like saving an image made with the front camera as an sprite and set this sprite as the stone for a player ( the image should be taken in the game before the game starts ) ) . So the stones each player set are individual.
It would be very nice if somebody have an idea how to do that and can help by this :slight_smile:
Thank you

Look at the camera example in the example projects, and see how they saved the pictures as sprites

Thank you but if I put a stone with that help, the stone shows a live video from the front camera but I want to take a picture and save it than but I think there is no way to do it Right?! :confused:

Here, try this


--# Main
-- Take Picture

function setup()
    cameraSource(CAMERA_FRONT)
end

function draw()
    background(40, 40, 50)
    
    sprite(CAMERA,WIDTH/2,HEIGHT/2)
    if savedImage then
        sprite(savedImage,200,200,200)
    end
    
end

function touched(touch)
    if touch.state == BEGAN then
        savedImage = image(WIDTH,HEIGHT)
        setContext(savedImage)
        sprite(CAMERA,WIDTH/2,HEIGHT/2)
        setContext()
    end
end


Sorry, I didn’t look at the camera example. My code was a bit over complicated. The example uses something like this instead

function touched(touch)
    if touch.state == BEGAN then
        savedImage = image(CAMERA)
    end
end

Way less complicated

Thank you very much :slight_smile: I just try it out