Inspiration

The current mindset seen on social media is that going to the gym will solve all your problems, which in this case includes being overweight or obese. As a result, the average teen who scrolls through this content gets fed this idea that going to the gym and working out is the solution to losing weight. Although going to the gym can help you lose weight, what you eat and the calories you consume is the main factor. We learned this through a simple class called “Nutrition and Fitness Concepts” in high school, but it didn’t just teach us how to exercise. It proved that the food you put into your body is a deciding factor to your fitness, in which so many people didn’t understand to the point that even the most motivated athletes thought that filling up with cake and exercising daily would change the game. Likewise, many teens experience rapid sugar cravings, where they consume junk food laced with artificial preservatives. By the time they’re full grown adults, it’s too late to get rid of these longstanding habits. Our game helps them break this unhealthy cycle by eating fruits to satiate their sweet tooths. It’s targeted towards people in a sensitive period of life where they can be influenced to transform into fitter people. In order to prevent them from obtaining this ubiquitous flawed mindset, our goal is to educate young teens on the importance of nutrition and fruit before social media can do its thing.

What it does

Our game has the sole purpose to educate the youth about the importance of eating fruits and having good nutrition. It’s a level-based game that makes the player fly and dodge obstacles such as blocks and avoid spikes to collect different fruits including blueberries, watermelons, avocadoes, apples, and bananas. Hitting a spike or block makes the player restart the level. After a fruit is collected, the player has to answer a question regarding that fruit’s nutrition, and the penalty for getting it wrong is having to restart the level. If the player gets the question right, they are then allowed to keep moving and they also gain 5 experience points. The goal is to get enough experience to advance to the next level, 10 to go to level 2, 25 to level 3 and then to finish the game 50 points. Each level has an increasing difficulty and a different terrain. Not only does this game serve as a challenging entertainment source for teens who especially have low attention spans, but ensures that they are understanding why eating food and having good nutrition are vital to a healthy lifestyle, especially when they grow older.

How we built it

We built our game using Python and Pygame. We designed a real-time interactive system that continuously updates player movement, the position of obstacles, and the background movement using a game loop. Player motion is handled by a gravity-based physics model, where the vertical velocity changes each frame to create smooth jumping and falling behavior. Horizontal movement is simulated by moving all the background elements across the screen, giving the illusion of forward motion while keeping player control consistent.

The game’s logic is built around defined states that control when the player can move, when questions are displayed, and when the response screens appear. Collision detection is handled through rectangular hitboxes, allowing for easy and reliable interactions between the player, obstacles, and fruits. When a collision occurs, the gameplay pauses and a multiple-choice question is generated based on the player’s current level and which fruit they collected.

We also created an experience-point-based progression system to balance difficulty and the amount of content players can access. Correct answers increase experience points, speed, and unlock additional levels while expanding the pool of available questions. Incorrect answers or hitting obstacles and spikes trigger a level reset, helping maintain the game flow.

While we chose not to rely on AI in building the game, we wanted to prioritize accessibility for players and judges if they wish to interact with it. To make NutriDash available online, we used Lovable to create a website for our game, making sure that anyone could play it easily without installing software. Overall, our system combines mechanics, state management, and education to create a scalable and accessible learning experience.

Challenges we ran into

During the development of our game, one major challenge we ran into was managing a shared game state across different systems. Our game relies on numerous global variables, like XP, level, player position, and question state, and making sure that these were updated properly in the movement, collision detection, and question handling was hard. Even minor mistakes with how their variables were changed could cause major issues like the game not fully resetting after the player hit an obstacle or answered a question incorrectly.

Another challenge we faced was handling the collision detection alongside different game states. The player can lose by hitting spikes, colliding with blocks, or selecting the wrong answer, but these events happen under different conditions. Making sure that each collision was detected properly while the game was paused for questions or death messages was another difficulty that we faced since we needed to make sure that failures always triggered the correct reset method.

We also struggled with implementing consistent reset logic. Resetting the game needed more than just moving the player back to the starting position; it required us to reset the XP, velocity, obstacles, fruit placement, and question activity at the same time. Forgetting to reset even one of these elements led to the code not working properly and made debugging challenging.

Balancing the difficulty of the game while keeping the game education was another obstacle we ran into but overcame. As the levels progressed, we increased the speed, obstacle frequency, and question difficulty, but by doing all three at the same time it sometimes made the game feel frustrating to play rather than engaging. We had to carefully adjust the progression so that the players can balance learning about healthy eating and also enjoy the gameplay.

Finally, the time constraints of the hackathon made debugging more difficult. Because we prioritized making the game playable and educational quickly, we used simpler structures like global variables instead of more complex object-oriented designs. While this helped us code faster, it also introduced challenges when scaling the game logic and fixing the bugs in a short period of time.

Accomplishments that we're proud of

  • We built a fully playable game from scratch that has real-time movement, collision detection, and a xp - based progression system using Python and Pygame.
  • We used our leveling and XP system to unlock new environments, fruits, and educational questions as the player progresses.
  • We designed an interactive question system that randomly selects nutrition-based questions that are tired to the fruits you collect.
  • We created a feedback system that has death messages, checkpoints at the start of each level, and visual overlays to help players understand mistakes and learn.
  • We balanced difficulty by adjusting the obstacle size, player scale, and the speed to keep the game challenging but also playable
  • We worked together effectively as a team to debug multiple issues we had such as collision handling and level transitions under the time limit we had.

What we learned

  • How visual design influences player engagement and clarity, especially for fast-paced games.
  • How to use sprites, scaling, and layering to establish smooth and visually appealing gameplay.
  • How to utilize Pygame’s rendering system to load, scale, and display images using convert() and convert_alpha().
  • How to implement layered drawing order (background to player to obstacles to UI) to ensure visual clarity.
  • How to create scrolling backgrounds using position variables and frame-based updates.
  • How to manage game states (paused, question active, death screen, game complete) to control what is rendered each frame.
  • How to optimize visuals by reusing assets, removing off-screen objects, and maintaining a stable frame rate.
  • How to combine collision detection and visual feedback to reinforce player actions and consequences.

What's next for NutriDash

  • Expand Nutrition Content: In the future we are planning to add vegetables, whole grains, and proteins. When adding these changes we also need to make more questions depending on the source of nutrition thus expanding our nutritional education.
  • Adaptive Difficulty: Another change we plan to add is related to the question difficulty and the speed/# of obstacles based on the player’s game performance to ensure teens don’t get bored easily.
  • Daily Challenges & Streaks: Next we can also implement daily runs and streak bonuses to motivate teens to consistently play and learn long-term healthy habits.
  • Progress Tracking: To further develop our game we can implement a descriptive dashboard representing the total XP earned, the nutrition topics mastered, and the types of fruits collected so far.
  • Classroom & School Use: Another development we plan to add is a teacher-friendly mode where NutriDash can be used as a learning tool for health classes within schools.
  • Increase Animation Quality: Last but definitely not least we plan to add polished and more modern animations, particle effects, and dynamic backgrounds to increase attention spam and make it more appealing.

Built With

Share this project:

Updates