ABOUT PROJECTS MODS CONTACT ×

Mochi, Run!

2D Infinite, Side-Scrolling Game

Mochi, Run! Logo

Background

"Mochi, Run!" was the first of many.
This was the project that really motivated me to go further into my journey. Written in C++ using the Raylib library, this is a simple 2D platformer heavily inspired by Google's Dinosaur Game.

The game features a simple infinite runner mechanic, where the player must jump over obstacles to avoid a game over. Their goal? To get the highest score possible.

Mochi, Run! Main Title Screen

Technologies Used

What I Learned

Proper Physics with Delta Time

When I started working on "Mochi, Run!", I thought, "How hard can it be to make the cat jump?"

Turns out, it's not just about moving pixels up and down on the screen. This project quickly taught me the importance of velocity, gravity, and the voodoo concept of delta time.

One of the pains in game development is that not all computers are created equal. Some are faster, some are slower. Imagine a player with a faster computer that gets 60 frames per second, while the second player barely gets 30 frames per second. The second player will see that the first player's character moves faster than theirs.

Delta time is essentially the time that has passed since the last frame was rendered. Think of it like this: instead of moving a character a fixed number of pixels every frame, you move it based on the time that’s actually passed. So, if one player’s computer is running faster than another’s, delta time helps make sure that both players experience the game at the same speed.

That’s the real magic of delta time—it keeps things consistent, even when the frame rate isn’t.

This fixed all the problems I had with the jumps being too high or too low, depending on the frame rate. It fixed the issues with animations being too fast and drones colliding with the player at Mach 5 speeds.

One of the most important lessons from my game dev journey so far: always make sure the game runs at a consistent speed, no matter what kind of hardware players are using. Sure, it's a small detail for developers, but it makes a world of difference that players of your game will notice.

2D Animations with Sprite Sheets

Before, I always thought animating 2D sprites were going to be easy. But this project humbled me real quick.

There's a whole rabbit hole on the art of sprite sheets. I spent more time than I care to admit staring at spreadsheets, lining up frames, and getting the timing just right. The main problem I faced was figuring out the correct order of frames and how long each frame should last. At one point, I ran into a specific issue where the running animation looked like it was skipping. I just couldn’t figure out why it didn’t look smooth.

After a while, I realized the issue was with the way I was calculating which frame to display. I was simply incrementing the frame index each time, without considering the elapsed time between frames. As a result, the animation speed varied depending on the frame rate, and sometimes frames would get skipped altogether.

What's crazy is that it was just for a simple jump and run animation.

Mochi, Run! Gameplay

Past all the code, this project also taught me that 2D animation is more than just pictures in motion—it's about precision, timing, and making sure every frame makes sense. It was about making sure each animation flowed perfectly with Mochi's movements and the game's physics.

Looking back, there's still noticeable flaws in the animations. But I'm proud of how this project turned out.