Jigsaw puzzle game

In this post, there is discuss of how to make a jigsaw puzzle game with javascript and webview.

Here is another version of jigsaw puzzle game, made with pure AI2 blocks, and extensions.

And the app looks like:

There are 4 extensions used in this app:

ImageConvertor by @TIMAI2 for image format convert, rotate, crop, resize..

PDEV2 by @TIMAI2 for make the jigsaw small pieces into different types.

SimpleSaf by @TIMAI2 for pick up the background image

CompCreator @Kevinkun for generate the imagesprite dynamically.

The main work of this app:

1. Load a background image

2. Convert the image to png, if it's not a png file

3. Rotate the image, if its width is bigger than height

4. Crop the image to fit the canva s

5. Resize the image according to column and ro w.

6. Draw the outline on the can vas

7. Cut the bg to small pi eces

8. Apply the mask on the p ieces

9. Apply the outline on the pieces

10. Generate the image Sprites

11. Drag the sprites

12. Check if they arrive the corrent position

The apk can be download from here:

jigsaw9.apk

jigsaw9.aia

10 Likes

Very clever! :smiley:

hi @Kevinkun I wanted to download the apk file to have a look at it. unfortunately is not possible :frowning:

The same to me…. (Italy)

Please try again. I don’t know why it’s deleted from sourceforge, now I uploaded again.

@x-tom-x @uskiara

1 Like

Now it works. will try it out in the evening…

1 Like

Just got -it ! Many thanks Kevin !:victory_hand:

In case someone want the aia (I made this on AI2Offline, maybe not compatiable with MIT server), I uploaded the aia file also.

3 Likes

:wink:

runs using Companion and aia, fails to compile when building, otherwise GREAT stuff (especially file access) on Android 13 Samsung. Thanks for sharing your code.

I tried it out. It works perfectly, and I'll keep this solution in mind. The idea with the masks for the puzzle pieces is great. The fact that generating the pieces and background image in ASD remains a constant size (number of files) is also excellent. The generated files are overwritten when a new image is created. This is important because who wants to back up their images in a folder that's only accessible via PC (at least on my tablet, that's not directly possible without additional apps)?

Generating the pieces with the maximum number of 8 x Z (11) takes a while. An acceptable duration.

The AI2 project is quite large. I know there are larger and more comprehensive ones, but I feel more comfortable working in a programming language. There I understand how the algorithm works and what's needed for quite quickly. I find that more difficult in AI2. But it's certainly a matter of practice.

It's great to see that it can be done with AI2. However, there are also some extensions in use here, and as far as I know, these are also programmed in JAVA. So the question is: what is native AI2 and what isn’ t…

Great job and a like from my side :slight_smile:

maybe because one extension CompCreator, I changed to an old version, it’s ok to build. You may want to download again.

2 Likes

Yes, the new version aia with the older version of CompCreater compiles beautifully. Thank you @Kevinkun

1 Like

By AI2Offline do you mean you built it using your own local instance of the MIT App inventor server?

@Kevinkun no love with sourceforge… it seem the files disappeared again.

I uploaded again, and this is the last time.

I mean this:

AI2Offline download | SourceForge.net

1 Like

how to make it?

check the aia in first post.