9

Cart #snowballnusan-0 | 2019-10-06 | Code ▽ | License: CC4-BY-NC-SA
9

Small game made for Ludum Dare 45 in 48h.

Roll your way through 7 levels and collect snow to make a happy snowman.

Controls:

• left/right: move
• up: jump
• x/c: reset level

The Ludum Dare page is here if you want to vote: https://ldjam.com/events/ludum-dare/45/snowball

P#68594 2019-10-06 22:14 ( Edited 2019-10-06 22:42)

:: dw817

Sweet ! Wish there were more levels. Final score, 815. Definite star for you. Good playing.

P#68604 2019-10-07 00:43 ( Edited 2019-10-07 00:43)

I enjoyed this one. The game fits the theme so well, and is so well implemented. Like dw817 I wish there were more levels.

P#68752 2019-10-11 06:40
:: Mot
1. This is a beautiful game.
Very satisfying (when things go right :).

How did you do the collision detection? Is it based on the sprite tiles? Or is there a separate collision model behind the scenes?

P#69096 2019-10-20 06:10
:: NuSan

@Mot I'm glad you liked the game!
So the collision detection is a bit of a mess but it works just using the sprite tiles, so it's great to make lots of tiles in a small time.
The main idea is to do "raycast" from 32 points along the ball edge in the direction of the motion. Each raycast go pixel per pixel until it finds a collision. So you find the nearest collision and you know you can move you ball at least that much.
The second part is to find a "normal" to the surface at the point of contact so that the ball can bounce. As the game is using pixel art, it's not that easy. I compute the normal by taking the average direction of every solid pixel in a box of 5x5 around the pixel collision.
Then I had to tweak things because it was not working very well, so I use the normal I found to push the ball outside of the surface. This make the ball shake a lot, so I do all those computations 5 times per frame and use the average as the ball position.
As I said, it's full of hacks and only works because there is only one ball and I can afford extra computation. I would like to revisit this code at some point to make it more robust.

P#69163 2019-10-22 09:23