Racso / fzero-apps

Apps I created for the Flipper Zero.
7 stars 2 forks source link

Sokoban: draw centered levels without scrolling and with bigger tiles if possible #10

Closed iliazeus closed 4 months ago

iliazeus commented 4 months ago

Draw levels centered; do not scroll them; allow edge tiles to be off screen (but leave at least one pixel of them visible).

There's not much info lost, since edge tiles are always walls anyway. But it allows us to have bigger tiles:

Microban lvl 60 - before ![Screenshot-20240722-175355](https://github.com/user-attachments/assets/0c56f371-949e-4db2-a059-99a15e292ced)
Microban lvl 60 - after ![Screenshot-20240722-181833](https://github.com/user-attachments/assets/8afbea53-bf1d-4976-91a2-4acdfb0d4c4a)

Disabling scrolling won't allow for very huge levels, but I think huge levels are bad game design for a Flipper game anyway :)

Racso commented 4 months ago

Thanks! I like the centered levels, and the way you managed to drop some cells to allow for bigger sprites. However, I don't like the scrolling being disabled.

I know that big levels in a small screen aren't ideal at all. In fact, when I was first working on the game, I simply removed the levels that didn't fit in the screen. However, I then noticed that I didn't like collections being incomplete, and I that I really wanted the game to be able to play any Sokoban level, even if some of them must be played in a non-ideal way.

Scrolling was only used in levels that didn't fit the screen at all. It wasn't enabled in levels that fit the screen (if it was, that's a bug). So my question is, why can't we leave scrolling enabled that way, so it only affects levels that require it to be playable?

iliazeus commented 4 months ago

Okay, I'll try to bring the scrolling back.

Racso commented 4 months ago

The calculations might get a bit complex, so a first iteration could be keeping both methods for rendering: the old one (allows scrolling) and the new one (centered, bigger tiles). And you call one or another based on the size of the level (new one for small levels, old one for big levels).

Racso commented 4 months ago

To clarify: I'm not talking about having two draw_game methods, but to extract the rendering into two other methods, and draw_game calls one of them based on an if.

iliazeus commented 4 months ago

I've integrated the changes into #8. And made the scrolling work!