The Castle
With the use of Minecraft Education
With the use of Minecraft Education
What is The Castle?
The Castle is a game where you infiltrate a massive castle, encountering levels to defeat the final boss at the end.
There are 3 different levels encountered in order.
The first level
Location: In front of the castle
The first level is encountered in the front of the castle. Your objective is to survive for 15 seconds as the agent spawns multiple mobs surrounding the player. Once 15 seconds pass, a "cutscene" will commence, showing the gate exploding in which the player can progress to the next level.
The second level
Location: Inside castle walls
In the second level, your objective is to free 4 villagers by breaking the glass cages they are put inside. However, it will not come easy as the agent spawns mobs to stop the player from freeing the villagers. Once all 4 villagers are freed, the player can enter the main castle which holds the third level.
The third level
Location: Inside main castle
On the third and final level, you must defeat the agent. In order to defeat the agent, you must destroy the agent's armor in which the agent has a total of 3. and in order to destroy a piece of armor, you must defeat a mini boss the agent will spawn. The agent will spawn these mini bosses in order and there will be a total of 4 mini bosses you must fight. Once you defeat the third mini boss, you will be able to break the agents last piece of armor
How to play
Type in the chat "start" to start the game
Complete the first objective (survive for 15 seconds)
Go into the castle and begin the second objective (free the 4 villagers)
Go into the main castle and defeat the boss
Code
Castle builder
Level 1
The code you see to the left is the code that makes the agent spawn the variety of mobs around the player.
Inside of a "repeat 10 times" block, the "monster" variable changes by 1 and the agent teleports randomly from "world position" (-2,-60,-11) to (-35,-60,-11).
If the "monster" variable is equal to 1, then a zombie pigman will spawn at the agent's position. That means when the loop is repeated once, a zombie pigman will spawn because the "monsters" variable will change by 1. If the "monster" variable is anything else, then if the "monsters" variable is equal to 2, then spawn an endermite. That means when the loop is repeated twice, an endermite will spawn because the "monsters" variable would have changed by 2. This will go on for the rest of the mobs. Once the 4th monster had spawned, the "monsters variable is set back to 0 so that the next time it loops, a zombie pigman will spawn.
The same thing is repeated after that. However, the agent will teleport randomly from world position (-2,-60,-44) to (-34,-60,-44). In which the agent will spawn the mobs behin
This is the code that tracks the time, as the objective of level 1 was to survive for 15 seconds. Inside of a "repeat 15" loop, after pausing for 100(ms), change the "time variable" by 1. Then, it will check if the "time" variable is equal to 10. after the loop is repeated 10 times, the "time variable would be equal to 10 because every time it loops, the "time" variable will change by 1. Once the "time" variable is equal to 10, a message will show in the chat saying "5 seconds left". And then when the "time variable" is equal to 15, all entities will be killed and "wave 1 complete" will be said in the chat.
Level 2
This is the code that places the 4 villagers in there glass cages, and also saying the objective.
This is the code that makes the "free the villagers" objective work. There are 4 different "on broken" code blocks in this code. One for each cage that holds the villager. However, all of them have the same code. Firstly, when the stained glass is broken, the cage is then replaced with air, which will make the cage dissapear. Then the "total villager" variable will change by 1. After that, a message will be said saying "villager "total villager value"/4. This will mean that the message will say how many villagers you have freed, as breaking one of the cages will change the "total villager" variable by 1. So if you were to free 1 of the villagers, the message will say "villager 1/4". If 2 villagers are freed then the message will say "villager 2/4" and so on. After the message is said, the game will check if the "total villager" variable is equal to 4. If the "total villager" variable is 4, then all entities will be killed and a function called "boss fight" will be broadcasted, which will go into the third level.
Level 3
This code is what starts the boss fight, The player will get 10000 (ms) of time to get into the main castle before the gate is closed behind the player. In which wood fences will be filled from world position (-21,-53,46) to (-25,-48,46). The agent will then teleport inside the main castle and then the agent after a 1000 (ms) pause, the agent will start spinning and then a message in the chat will say the new objective "objective: defeat the boss" and another message followed that will say "boss armor (value of the variable "boss armor")/3.
After that, the agent will teleport to on corner and start spawning in vexes. Then the agent will teleport to another corner and start spawning in more vexes.
After the player survives the vex attack for 14000 (ms), all the vexes will be killed and a ravager will spawn which is the first mini boss. Once the player kills the ravager, the "bomb" function will be called
This is the code that tells the game whether the player has broken the pillars and how many times the player had broken a piece of the boss's armor.
When the crying obsidian or purple glazed terracotta is broken, the "boss time" variable will change by 1. And when the obsidian block is broken, the boss's armor will change by -1. Then the boss's total armor will be said in the chat. Since the mini boss order goes from ravager, zoglin, to wither skeleton. The game will first check if the player had killed the wither skeleton mini boss. If the player has, then the "final boss" function will be called. If the player hasn't, then the game will check if the player had killed the zoglin mini boss. If the player did, the a function called "boss wave 3" will be broadcasted. If the player did not, then the game will check if anything else happened and if anything else happened, then a function called "boss wave 2" will be called.
This is the code that makes the agent try to spawn the bomb with the pillars surrounding it. The code shows that there will be a total of 7 blocks worth to destroy that will be spawned.
The entire strip of code is not shown as it is too long however, the code is basically the same throughout. every 1500 (ms), the pile of tnt will slowly get bigger.
After many of the repeated code, the tnt pile would have reached a certian height, then the game will check, "if boss time is equal to 7". If the "boss time" variable is equal to 7 (meaning the pillars surrounding the tnt are all broken) then the tnt pile will be replaced with air. However, if "boss time" variable is anything else, the bomb will ignite and destroy everything.
This is the code to the other 3 mini bosses in order. It is basically the same code as ravager mini boss. Vexes will spawn and after the player survives for a certain amount of time, the mini boss will spawn. And upon killing it, the agent will try to summon the bomb.