ninetailsrabbit / match3-board

This lightweight library provides the core logic and functionality you need to build engaging match-3 games. Focus on game design and mechanics while leaving the complex logic to this library
https://godotengine.org/asset-library/asset/3405
MIT License
12 stars 2 forks source link

Fix special pieces not being consumed correctly #11

Closed univeous closed 1 week ago

univeous commented 1 week ago

Description

Fix the problem I mentioned in #5.

I have to say I still don't have a good understanding of how this plugin works as a whole though;

So please also double check that it doesn't introduce any problems : )

ninetailsrabbit commented 1 week ago

@univeous As I am seeing it seems that creating pieces with more advanced behaviors costs in the way this plugin is built.

In the end I'm limited to Gdscript where you can't use a more flexible and dynamic architecture as it can be in C# or other strong-typed languages.

I can't spend that much time on it either since it's a plugin that not many people use and I'm not making money with it but I will look for a way to make adding behaviors to the special pieces easier.

ninetailsrabbit commented 1 week ago

Hey @univeous I forgot to review the code. It seems ok but I would vote for using the consume_only() method that already exists in the Sequence instead of creating the only_normal_and_special_pieces_triggered method, which is too big a name. I am a fan of making modular functions and combining them to cover an adequate number of operations.

So the new method to obtain special cells in a sequence could be simplified like special_cells(include_triggered: bool = false) and use like this to achieve the same result of your commit sequence.consume_only(normal_pieces_cells + special_pieces_cells(false))

Tell me if sounds good to you

univeous commented 1 week ago

I have no objections. Should you make the changes or should I?

ninetailsrabbit commented 1 week ago

It's your pull request, I yield the honour 😃

univeous commented 1 week ago

Done!

univeous commented 1 week ago

I don't think that's quite right; the current behavior is to consume all normal and special pieces, whereas the correct behavior should be to consume all normal and triggered special pieces. So it should be done withsequence.consume_except(special_pieces_cells(false))