Pizza One Two Three is a pizza making game designed to introduce fractions to students grades 1-3. The game focuses on the concepts of making fractions, making equivalent fractions, and time management skills all while maintaining an enjoyable experience for students. The game also features an endless mode for students to further strengthen their understanding, and a backend server for teachers to track students’ progress. The goal of the game is to making 900$ over the course of 7 days by serving properly cut pizzas to customers.
Original Cutting Mechanic
The team anticipated that the most difficult part of the game to create would be the pizza cutting mechanic.
I was assigned this task and began working on creating a way to cut an object in two. I started by making a way to draw a line when the player clicked one spot, and then clicked another. I did this by taking the two points that the player tapped and, by using trigonometry, figuring out where the corner points of the rectangular line should go. Then I made a mesh by drawing triangles between those points, and then drew that mesh.
I discovered that the easiest way to do “cut” an object in half is by duplicating an object on top of itself, and then drawing two sprite masks, one that covered half of one copy, and one that covered the other half of the original. When made so these sprite masks would only interact with one of the objects each, this would give the illusion that the object had been cut in half. To do that, I created two empty parent objects, and put one mask and one object as a child of each parent. Then, I made the parent objects sorting groups, so that they would only interact with children of that empty parent object.
Next, I had to get the object and the “pizza” to collide, so I added a line collider that would generate with each new line to my line maker, and a circle collider to the “pizza”. I then made it, “cut” the pizza every time that the line and the pizza collided.
After that I had to figure out how to count the number of slices that the player made, which is where I ran into my biggest issue. When you cut an object through its center, you can only cut two extra pieces with each cut (excluding 1 -> 2). Even if you don’t cut through the center, the number of pieces will always be lower then 2# of Cuts. This became an issue since regardless of how you cut the pizza, two copies would be made each cut for each piece of the pizza. This made the number of empty objects equal to 2# of Cuts. This discrepancy between the number of empty objects and the number of cuts was output as useless objects; objects that were fully covered by sprite masks. Since no part of these useless objects were shown, they could be deleted without changing how to pizza looked. I eventually discovered that for these useless objects, the sprite masks center points all average out to approximately the center of the object, whereas the regular pieces did not. When this was detected, I deleted that portion. For pieces that were cut in the middle of the pizza, their sprite masks would still average to the center of the pizza even though they were not covered. Therefore, I added that if one of the sprite masks centers was far enough from the center of the object, it would not be deleted.
This deleted all of the useless objects from the cuts, and would allow me to read the remaining number of empty objects and get the number of pieces.
A level system was added into the game to allow the player to follow their progress. The number of customers that the player will interact with will increase every day. This also contains the win condition where the player must make 900$ after 7 days. If the player wins, they can choose to start over to play to infinity. If they lose, they must start the game over.
To make the game more enjoyable, the team decided to create a system that would make the player have to decorate the pizza with certain toppings. One of the team members developed a system to add toppings onto the pizza, while another added a system to randomly generate the required toppings. I had to combine these two systems so that it would check if the right toppings had been added, and change the players score whether they had the correct toppings or not. To do this, I made a way to read which topping was placed and would add one to a topping counter for each individual topping. The same was true for deleting the toppings, except that it would subtract one. Then, I would check if the number of the required toppings were all greater than one, and that no other topping was greater than one. This would properly check whether the correct toppings were added to the pizza. If the player got the toppings correct, they would receive full points, and if it was incorrect, they would receive half points.
Music and Mute Button Into Game
The game music created by one of the group members was added into the game as background music, and a mute button for the background music was added as well.