An aquarium you fill by clicking. Click on the left half of the tank and a fish appears where you clicked; click on the right half and you get a crab. The deeper you click, the bigger the creature. Every fish, crab, and strand of seaweed is drawn by a method you call with parameters.

The finished aquarium after eight clicks
'F' → Fullscreen
Create a new Raylib program named 2-7-aquarium. You start with a fixed tank, then let the mouse fill it, and finally make where you click decide what appears and how big.
How to read the code blocks. Each task's code block shows your whole program, from line 1, as it should look when that task is finished.
The green lines marked with a + are the ones you add or change for that task — everything else is already in your file. Do not type the + sign.
DrawFish takes a position, a size, and a color: a tail and a body drawn with Raylib.DrawEllipse, which takes a center, a half-width and a half-height, and a black eye. DrawSeaweed stacks short green pieces up from the sand, nudging every second piece to the right.#:package Raylib-cs@8.0.0
using Raylib_cs;
Raylib.InitWindow(800, 450, "Aquarium");Raylib.SetTargetFPS(60);
while (!Raylib.WindowShouldClose()){ Raylib.BeginDrawing(); Raylib.ClearBackground(Color.DarkBlue); Raylib.DrawRectangle(0, 400, 800, 50, Color.Beige);
DrawSeaweed(120, 160); DrawSeaweed(560, 240); DrawSeaweed(700, 100);
DrawFish(250, 150, 60, Color.Orange); DrawFish(575, 300, 50, Color.Yellow); DrawFish(620, 120, 90, Color.Pink);
Raylib.EndDrawing();}
Raylib.CloseWindow();
void DrawFish(int x, int y, int size, Color color){ Raylib.DrawEllipse(x - size / 2, y, size / 8, size / 3, color); Raylib.DrawEllipse(x, y, size / 2, size / 3, color); Raylib.DrawCircle(x + size / 4, y - size / 10, size / 12, Color.Black);}
void DrawSeaweed(int x, int height){ int pieces = height / 20;
for (int i = 0; i < pieces; i++) { int sway = 0;
if (i % 2 == 1) { sway = 8; }
Raylib.DrawRectangle(x + sway, 400 - (i + 1) * 20, 12, 20, Color.Green); }}DrawFish calls from the main program, including the one you added. The tank starts empty now.if on lines 18–21. It draws a fish at the pointer on the frame you click.#:package Raylib-cs@8.0.0
using Raylib_cs;
Raylib.InitWindow(800, 450, "Aquarium");Raylib.SetTargetFPS(60);
while (!Raylib.WindowShouldClose()){ Raylib.BeginDrawing(); Raylib.ClearBackground(Color.DarkBlue); Raylib.DrawRectangle(0, 400, 800, 50, Color.Beige);
DrawSeaweed(120, 160); DrawSeaweed(560, 240); DrawSeaweed(700, 100);
if (Raylib.IsMouseButtonPressed(MouseButton.Left)) { DrawFish(Raylib.GetMouseX(), Raylib.GetMouseY(), 40, Color.Orange); }
Raylib.EndDrawing();}
Raylib.CloseWindow();
void DrawFish(int x, int y, int size, Color color){ Raylib.DrawEllipse(x - size / 2, y, size / 8, size / 3, color); Raylib.DrawEllipse(x, y, size / 2, size / 3, color); Raylib.DrawCircle(x + size / 4, y - size / 10, size / 12, Color.Black);}
void DrawSeaweed(int x, int height){ int pieces = height / 20;
for (int i = 0; i < pieces; i++) { int sway = 0;
if (i % 2 == 1) { sway = 8; }
Raylib.DrawRectangle(x + sway, 400 - (i + 1) * 20, 12, 20, Color.Green); }}count says how many are in use. A click stores its x and y at position count, then adds 1 to count.BeginDrawing, and a for loop that draws every stored fish, every frame. Delete Task 2's if.#:package Raylib-cs@8.0.0
using Raylib_cs;
int[] xs = new int[20];int[] ys = new int[20];int count = 0;
Raylib.InitWindow(800, 450, "Aquarium");Raylib.SetTargetFPS(60);
while (!Raylib.WindowShouldClose()){ if (Raylib.IsMouseButtonPressed(MouseButton.Left) && count < xs.Length) { xs[count] = Raylib.GetMouseX(); ys[count] = Raylib.GetMouseY(); count = count + 1; }
Raylib.BeginDrawing(); Raylib.ClearBackground(Color.DarkBlue); Raylib.DrawRectangle(0, 400, 800, 50, Color.Beige);
DrawSeaweed(120, 160); DrawSeaweed(560, 240); DrawSeaweed(700, 100);
for (int i = 0; i < count; i++) { DrawFish(xs[i], ys[i], 40, Color.Orange); }
Raylib.DrawText($"Fish: {count} of {xs.Length}", 20, 20, 20, Color.White); Raylib.EndDrawing();}
Raylib.CloseWindow();
void DrawFish(int x, int y, int size, Color color){ Raylib.DrawEllipse(x - size / 2, y, size / 8, size / 3, color); Raylib.DrawEllipse(x, y, size / 2, size / 3, color); Raylib.DrawCircle(x + size / 4, y - size / 10, size / 12, Color.Black);}
void DrawSeaweed(int x, int height){ int pieces = height / 20;
for (int i = 0; i < pieces; i++) { int sway = 0;
if (i % 2 == 1) { sway = 8; }
Raylib.DrawRectangle(x + sway, 400 - (i + 1) * 20, 12, 20, Color.Green); }}sizes and isCrab. A click now works out a size from how deep it is — 20 + y / 8, so clicks near the sand make bigger creatures — and stores whether it was on the right half of the tank.DrawCrab, written yourself from the description. It takes x, y, and size, and every measurement should be worked out from size, the way DrawFish's are.#:package Raylib-cs@8.0.0
using Raylib_cs;
int[] xs = new int[20];int[] ys = new int[20];int[] sizes = new int[20];bool[] isCrab = new bool[20];int count = 0;
Raylib.InitWindow(800, 450, "Aquarium");Raylib.SetTargetFPS(60);
while (!Raylib.WindowShouldClose()){ if (Raylib.IsMouseButtonPressed(MouseButton.Left) && count < xs.Length) { xs[count] = Raylib.GetMouseX(); ys[count] = Raylib.GetMouseY(); sizes[count] = 20 + ys[count] / 8; isCrab[count] = xs[count] >= 400; count = count + 1; }
Raylib.BeginDrawing(); Raylib.ClearBackground(Color.DarkBlue); Raylib.DrawRectangle(0, 400, 800, 50, Color.Beige);
DrawSeaweed(120, 160); DrawSeaweed(560, 240); DrawSeaweed(700, 100);
for (int i = 0; i < count; i++) { if (isCrab[i]) { DrawCrab(xs[i], ys[i], sizes[i]); } else { DrawFish(xs[i], ys[i], sizes[i], Color.Orange); } }
Raylib.DrawText($"Creatures: {count} of {xs.Length}", 20, 20, 20, Color.White); Raylib.EndDrawing();}
Raylib.CloseWindow();
void DrawFish(int x, int y, int size, Color color){ Raylib.DrawEllipse(x - size / 2, y, size / 8, size / 3, color); Raylib.DrawEllipse(x, y, size / 2, size / 3, color); Raylib.DrawCircle(x + size / 4, y - size / 10, size / 12, Color.Black);}
void DrawSeaweed(int x, int height){ int pieces = height / 20;
for (int i = 0; i < pieces; i++) { int sway = 0;
if (i % 2 == 1) { sway = 8; }
Raylib.DrawRectangle(x + sway, 400 - (i + 1) * 20, 12, 20, Color.Green); }}
// DrawCrab(x, y, size) draws a red crab centered on (x, y):// a red oval body, size wide and half as tall// (Raylib.DrawEllipse takes the half-width and half-height, like DrawFish's body),// a red circle claw at each top corner of the body,// and two small black eyes on top.// Write it here, below DrawSeaweed.Three things, one at a time. Write down exactly what happens.
&& count < xs.Length, so the check is only if (Raylib.IsMouseButtonPressed(MouseButton.Left)). Run it and click 21 times. Copy the error and its line number, and explain which line ran out of room and why. Put the check back.if, add an if on Raylib.IsMouseButtonPressed(MouseButton.Right) whose body is count = 0;. Fill the tank, right-click, and fill it again. Explain why the old creatures do not come back, even though their numbers are still in the arrays.Keep the right-click. Your finished program is Task 4 with the right-click added and the comment at the top.
DrawFish a fifth parameter, bool faceLeft. When it is true, the tail goes on the right and the eye on the left.facing that is 1 normally and -1 when faceLeft is true, multiplied into the two offsets that put the tail behind and the eye in front.bool parameter that decides which way something is drawn is a parameter that changes what the method does.Every picture below is a screenshot of this page's own programs, with the clicks played back automatically.

Task 1, as written

Task 1, yellow fish called before the seaweed

Task 2, the frame of the click

Task 2, one frame later

Task 3, after six clicks
Task 5's first change, on the 21st click:
Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array. at Program.<Main>$(String[] args) in 2-7-aquarium.cs:line 18DrawFish, DrawSeaweed, and your DrawCrab are all below the main program, and every measurement in DrawCrab comes from sizeAnswer the following questions before submitting your work.
Submit four things to the dropbox:
DrawCrab, the right-click, and the comment at the top.