Name Date Size

..25-Oct-20244 KiB

.gitignoreH A D25-Oct-2024100

AppScope/H25-Oct-20244 KiB

build-profile.json5H A D25-Oct-20241.1 KiB

entry/H25-Oct-20244 KiB

hvigor/H25-Oct-20244 KiB

hvigorfile.jsH A D25-Oct-2024168

hvigorwH A D25-Oct-20242.1 KiB

hvigorw.batH A D25-Oct-20242 KiB

oh-package.json5H A D25-Oct-2024815

README.mdH A D25-Oct-20241.5 KiB

README_zh.mdH A D25-Oct-20243.6 KiB

screenshot/devices/H25-Oct-20244 KiB

README.md

1# Puzzle Game
2
3### Introduction
4
5This puzzle game app is developed based on the **\<Grid>** component. It uses the `Image` and `MediaLibrary` APIs to obtain and crop images. Below shows the sample app.
6
7![running](screenshot/devices/change.jpeg)
8
9### Concepts
10
11`ImagePacker`: a class that provides APIs to pack images. Before calling any API in `ImagePacker`, you must use `createImagePacker` to create an `ImagePacker` instance.
12
13`MediaLibrary`: a class that provides APIs to access and modify media data such as audios, videos, images, and documents.
14
15### Required Permissions
16
17ohos.permission.READ_MEDIA
18
19### Usage
20
211. The sample app reads the image files on the local device and displays the first image it obtains. If there is no image on the local device, a blank is displayed.
22
232. Touch **Start**, and the countdown begins. If you fail to finish the puzzle within the specified time, the game ends. You can touch **Restart** to play the game again.
24
253. When the game is in progress, you can touch any image around the gray grid to swap the position of the image and highlighted grid cell, until you get a complete image.
26
274. When the game is not in progress, you can touch the large image on the top and select another image for the game.
28
29### Constraints
30
311. This sample can only be run on standard-system devices.
32
332. This sample demonstrates the stage model, which supports only API version 9.
34
353. This sample requires DevEco Studio 3.1 Canary1 (Build Version: 3.1.0.100) to compile and run.
36