Last week, we had a mobiLEHIGH tutorial session, and a student asked about how to make Fruit Ninja with LibLOL. It turns out that getting the right behavior isn't all that hard... you can use the "scribble" feature to detect a "slice" movement on the screen, and configure the obstacles that are scribbled to have the power to defeat enemies.
There was just one problem... configuring the obstacles requires changing the LibLOL code. I don't discourage people from changing LibLOL, but it's better to have an orthogonal way of getting the same behavior. In this case, it's easy: let the scribble mode code take a callback, and use that callback to modify an obstacle immediately after it is created.
This is one of those changes that I can't help but love... there's less code in LibLOL, and more power is exposed to the programmer. But it's not really any harder, and there's less "magic" going on behind the scenes now.
Here's an example of how to provide a callback to scribble mode:
I'm starting to think that I should redesign more of the LibLOL interfaces to use callbacks... what do you think?