Note: To access all shared projects, get information about environment setup, and view other guides, please visit Explore-In-HMOS Index.
This sample demonstrates how to build a match-3 candy game for HarmonyOS wearables. Candies are swapped with a swipe or two taps on a 6x6 board shaped for the round watch face, matches of 3 or more are cleared with cascading combos, and the score fills a progress ring around the screen until the target is reached within the move limit
- Swap two neighbouring candies with a swipe, or tap one candy and then its neighbour
- Clear horizontal and vertical runs of 3, 4, 5 or more candies for 60, 150, 300 and 500 points
- Chain cascades after gravity and refill, multiplying the score by the combo count
- Undo a swap automatically when it does not create a match, without spending a move
- Reshuffle the board automatically when no valid move is left
- Reach 2000 points within 20 moves to clear the level, with the progress ring showing how close you are
- Get vibration feedback on selection, invalid swaps, matches, combos and the end of the game
- Language: ArkTS
- Framework: HarmonyOS SDK 6.0.2(22)
- Tools DevEco Studio 6.0.2
- Libraries:
- ArkUI:
PanGestureandonClickfor swipe and tap input,animateTofor clear and fall animations,Progressring for the score target. - Sensor Service Kit:
vibratorused for haptic feedback. - Basic Services Kit:
BusinessErrorused for typed error handling.
- ArkUI:
entry/src/main/
├── ets/
│ ├── entryability/
│ │ └── EntryAbility.ets # Ability entry
│ ├── game/
│ │ └── Board.ets # Board shape, match finding, scoring, gravity, refill and move check
│ └── pages/
│ └── Index.ets # Game screen, input, animations, haptics and result overlay
└── module.json5 # Wearable device type and vibrate permission
- Huawei wearables running HarmonyOS 6.0.0(20) or later
ohos.permission.VIBRATEis required for haptic feedback
How to Make Sweet Match is distributed under the terms of the MIT License. See the LICENSE for more information.
