How to Tweak the “Big Watermelon” Cocos Game: Source Files and Score Hacks
This guide walks you through the core source files of the popular “Big Watermelon” Cocos game, explains its simple click‑collision‑score‑display flow, and shows concrete code snippets for altering the scoring logic or other gameplay tweaks, while hinting at algorithmic optimization.
Game Overview
The “Big Watermelon” (合成大西瓜) game is a simple, ad‑free mobile game that became popular on Chinese social media. Players tap to drop fruits, collide them, earn points, and see their rank against global players.
Source Structure
The game is built with the Cocos engine and consists of four core files:
index.html settings.js project.js ads.jsThese files contain the UI layout, configuration, main game logic, and ad handling respectively.
Modifying the Score
The game loop follows a straightforward sequence: click → collision → scoring → display . To change how points are calculated, you can either adjust the scoring rule or modify the final displayed value. The scoring variable is referenced by the keyword score (or addScore).
In the source you will find a line similar to: a.default.score += this.fruitNumber + 1 Changing the constant 1 to any custom number or to a variable (e.g., extraScore) directly alters the points awarded per fruit:
a.default.score += this.fruitNumber + extraScoreAfter editing, rebuild or reload the game to see the new scoring behavior.
Other possible “magic‑mod” ideas include forcing the same fruit to drop each round by locating the fruit‑generation code and editing its parameters.
Algorithmic Optimization (Optional)
Beyond manual tweaks, you can treat the game rules as a small optimization problem and train an algorithm to automatically discover high‑scoring strategies, turning the casual game into a testbed for simple AI techniques.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
