Num Nums!A casual treat-eating game. Advance forth to collect treats but avoid the dangerous walls!
|
🎮 How to play
- Use the left mouse button to make the hungry cat run forwards. He will automatically run to the left and right, for better or worse!
- Don't hit the walls and see how many treats you can get!
💡 Code Insight: Using math functions to manage player movement
The cat runs from left to right in according to a cosine function. He accelerates to the middle and then decelerates to a stop before turning around and running back.
The cat runs from left to right in according to a cosine function. He accelerates to the middle and then decelerates to a stop before turning around and running back.
The x velocity (the movement on the x axis) has to be independent from the y velocity in order to produce the predictable movement and allow the player to feel like they have a lot of control over the cat.
Every frame, the x velocity is set, then the y velocity. This makes sure the cat moves at the same rate on the x axis regardless of the y axis movement.
Every frame, the x velocity is set, then the y velocity. This makes sure the cat moves at the same rate on the x axis regardless of the y axis movement.
Build something that makes you think.