How to check whether the jigsaw puzzle is completed or not?

后端 未结 4 1648
面向向阳花
面向向阳花 2021-01-26 00:40

i am preparing one small game like jigsaw , for that i am using 9 imageview\'s with 9 different images in the layout. set the images to imageview at the time of starting those a

4条回答
  •  春和景丽
    2021-01-26 01:21

    Ok, here is what you do for the solution.

    1. maintain a new set of drawables marking them as original drawables that you had initially. may be like

    drawable og11 = imageView11.getDrawable(); do this part before shuffling. now you have original drawables, stored in the form of drawables.

    1. After every click , check if og11 == imageView11.getDrawable(),... and so on for all the images in the jigsaw, if they match , it matches, else, they don't.

    HTH.

提交回复
热议问题