skip to Main Content

THIS IS ANSWERED NOW 🙂

I’m building a jigsaw game, I have no problem with programming it if the images are cut with photoshop, no problem..

today, I have an image taken by camera

I want to slice this image into jigsaw pieces dynamically, inside the corona script.

can corona masking feature do this?

I want to have these pieces as separate objects, can I do this with corona SDK? How?

Thanks a lot.

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    answer:

    yes masks are enough and it's easy, it worked very nice!

    Code

    MJ = display.newImage("MJ.jpg",200,200)
    
    MJ.width = 300
    MJ.height = 300
    
    mask = graphics.newMask( "mask.png" )
    
    MJ:setMask( mask )
    

    arbitrary mask I created

    enter image description here

    Result

    enter image description here


  2. I think the easiest method would be to generate masks for each puzzle and simply generate X instances of image and mask each one with another mask. You may add a object.id or object.column and object.row to determine their index or position.

    Here’s a masking tutorial for you:

    https://docs.coronalabs.com/daily/guide/media/imageMask/index.html

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search