Play Block Code Duck Pond Online Free

Code a rubber duck to aim, scan and swim, first with blocks and then by typing real JavaScript.

Block Code Duck Pond title screen on SZ Games
  • Touch: some features

Tip: rotate your phone to landscape so the play area gets wider.

Block Code Duck Pond turns coding practice into small duck battles. Your orange rubber duck floats in a blue pond with one rival. It can fire a cannon, scan for enemies and swim, but only when your program says so. Each rival needs a different trick to beat. The game is adapted from Google’s open-source Blockly Games.

Blocks First, Then Real Code

There are ten levels made of five challenges. Each challenge shows up twice. First you solve it by snapping blocks together. Then the very next level gives you a code editor with line numbers, and you type the same solution as JavaScript. Seeing both forms side by side makes the jump from blocks to text much smaller.

How a Battle Plays Out

The pond sits on the left with health bars underneath. Build your program, press Run Program, and your duck acts it out live. Bring the rival’s health to zero to win. The success box shows the JavaScript behind your work, and OK takes you onward.

The Five Challenges

  1. A sitting target. Aim once at the right angle and range.
  2. A tough target. It takes many hits, so you need a while loop.
  3. A moving target. Use scan to find where it is each time.
  4. A far target. It is out of cannon range, so swim toward it.
  5. Careful approach and a runner. Swim partway, stop, then fire. The final rival tries to flee once it is hit.

How to Control Block Code Duck Pond

Input guide for Block Code Duck Pond
To do thisOn a keyboardWith a mouseOn a touchscreen
Assemble a program (block levels)—Pull blocks out of the Pond and Math categoriesDrag the blocks with a finger
Code a program (JavaScript levels)Type inside the code editorClick into the editor to set the cursor—
Enter an angle or numberType the number, then press EnterClick on the value and type a replacementTap on the value
Start or reset the battle—Click Run Program, and later ResetTap Run Program, and later Reset
Browse the command reference—Open DocumentationTap Documentation to open it

Coding Hints

  • Sketch the angle. Straight up is 90 and straight right is 0. Work out diagonals from there.
  • Pass scan into cannon. Using scan(angle) as the range means your shot lands on a target that moves.
  • Loop your attack. Put cannon calls inside while (true) so the duck keeps firing.
  • Check your own bar. Collisions cost you health too.
  • Open Documentation. It explains loc_x, loc_y, speed and health, which help with the final pair.

Device Notes and Who It Suits

This is a good fit for beginners and students who want a gentle first step into JavaScript. Block levels work with touch, but the typing levels need a keyboard, so a computer is best. If you enjoy it, try Block Code Maze for a pure block challenge.

Last played and checked by SZ Games:

Block Code Duck Pond – Questions and Answers

Do I need to know JavaScript to start?

No. Every challenge comes first as a block level. After you win, the game shows the JavaScript your blocks made, and the next level asks you to type that same idea.

Which way is zero degrees?

Zero points right, 90 points up, 180 points left and 270 points down. The Documentation panel has a compass if you forget.

How far can my cannon shoot?

Up to 70 meters in a pond that is 100 by 100 meters. If a target is farther than that, you have to swim closer first.

Can I hurt my own duck?

Yes. Ramming another duck damages you as well. One level is built around stopping short and firing instead.

Try Something Different