In case the Github repo links don't work for some reason, here is our repl link: Version below displays tips at the end of the game when you deliver 10 pizzas (move over the tables multiple times and try not to hit the asteroid obstacle): https://repl.it/@MysteriousHatte/GrizzHacks2#main.py The Github for this code (linked in the Github field below) is registered to Supergeek57. Version below is in the demo video: https://repl.it/@SwabhanKatkoori/GrizzHacks#main.py The Github for this code (linked in the Github field below) is registered to usermiia.
Why This Hack? Our Inspiration
What’s the worst part of picking up a delicious pizza on a Friday night? The place is packed, and you end up waiting in line for half an hour with a bunch of other grumpy, hangry customers. This hack was designed to solve that pressing problem by providing a new source of entertainment to take everyone’s mind off food (well, sort of) and doing some good in the community, too! During the COVID-19 pandemic, it’s important to follow social distancing protocols to keep everyone in the community safe, and we teach this in our hack by integrating a penalty when the player’s avatar collides with another person.
What Does It Do?
Our hack is a fast-paced, retro-style pizza delivery game that involves running, jumping, and dodging obstacles to get hot pizzas to hungry customers on time. During normal times, the game would only be playable in a Little Caesars store while waiting for a carry-out order, but during the pandemic, it would be available when a customer ordered directly through the Little Caesars website (not when ordering through Doordash, etc., as an incentive to order through Little Caesars). Successfully delivering a pizza to a customer by hitting the customer’s target will give the player $0.05 in tips. If a customer has to wait more than 5 seconds for an order, he/she becomes hangry, and $0.02 worth of tips are lost for that customer. The player also loses $0.02 in tips if they collide with any other people (this simulates the 6’ social distancing requirement during the COVID-19 pandemic.) The goal of the game is to deliver 10 pizzas while hitting as few obstacles as possible (each collision with an obstacle will cause the player to “lose” one pizza, increasing the number of pizzas to deliver by one unless that number is already at 10 and subtracting the most recent tip earned). At the end of the game, the amount of “tips” earned from successfully delivering pizzas will go toward either a monetary donation for a charity of the customer’s choosing, or a free pizza for a local food bank.
How we built it and how it works
We created the game in the repl.it IDE using pygame, because repl is a convenient, browser-based IDE that allows everyone on the team to collaborate on the code. Pygame is a user-friendly, easy-to-learn platform for building games in Python, which was the preferred language for our team since we all had a moderate amount of experience in it. Because we were all comfortable with the language we used, we could spend more of our time learning how to effectively use the tools within Pygame rather than reviewing Python’s syntax. In our program, we use the coordinates of the asteroid obstacle (astx and asty) and the targets (destx, desty, dest2x, and dest2y) to create a “collision test” for each of those objects. Within the “while true” loop that continually updates the game’s screen, we perform the tests and then use “if” loops to increase or decrease number of pizzas to deliver and tips accordingly. We also use “tick” within the Clock object in pygame to get the number of milliseconds since tick was last called (we call tick when the game starts and when a collision with a target occurs) in order to evaluate whether a customer is “angry” (this occurs after 5 seconds). If the time since tick was last called is more than 5000 milliseconds, the tip earned from that delivery will be decreased by 0.02.
Challenges we faced
Because most of our code needs to be within a “while true” loop in order for the screen to update properly, it was difficult to get the values for number of pizzas to deliver and tips to increment only one time for a collision. One attempted fix used the variable “times,” which used an if loop with the intent to only increment the “tips” value when “times” was less than one. “Times” would increase by one at the end of every collision loop, so that the player would have to go to a different target when they had collected the tips for that target. When all targets had been collected, all of their “times” values (times, times1, etc.) would be set back to zero to allow for more collisions. This seemed to have no effect--the “tips” value continued to increment multiple times on one collision.
Accomplishments that we're proud of
Three out of four of the members of our team weren’t familiar with Pygame before this hackathon, and we did tutorials, researched documentation, and taught ourselves enough Pygame to make an awesome pizza game in 36 hours!
What I learned
Throughout this challenge, we learned a ton about the logic and syntax of pygame, as well as the science of creating a positive user experience. This hack definitely gave us a better appreciation for how hard it is to iron out bugs from huge programs that run complex PC or mobile games.
What's next for Pizza For Good
Some refinements we’d like to make to this hack: Add a place where customers can see their process toward a monetary goal Add more levels, obstacles, and a vehicle component (the player’s vehicle gets upgraded, allowing them to move faster, if they spend tips throughout the game). Add a time bonus or free vehicle upgrades for referring other customers with a unique referral link
Log in or sign up for Devpost to join the conversation.