Game Development 4 min read

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.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Tweak the “Big Watermelon” Cocos Game: Source Files and Score Hacks

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.js

These 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 + extraScore

After 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.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaScriptGame DevelopmentTutorialCocosScore Modification
Liangxu Linux
Written by

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.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.