Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Camera picture as sprite

edited July 2015 in Questions Posts: 27

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 :)
Thank you


  • Posts: 835

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

  • Posts: 27

    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?! :/

  • Posts: 103

    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
  • Posts: 103

    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)

    Way less complicated

  • Posts: 27

    Thank you very much :) I just try it out

Sign In or Register to comment.