Closed oaklandgit closed 3 years ago
@oaklandgit Thanks! I've never been a fan of that style - can end up making your code very messy and hard to read if it's overused. Plus, to implement it requires a what always feels like a bit of hack to the function return, and I always wonder what the the memory implications might be.
Thanks for your reply @kittykatattack.
On the point of it making code messy, I see it as the difference between this:
mySprite.setPosition(10,10); mySprite.scaleX(0.5); mySprite.rotate(45);
vs.
mySprite .setPosition(10,10) .scaleX(0.5) .rotate(45);
But I hadn't thought about memory implications.
Anyway, great framework and I love your books!
Hi,
I'm not an advanced JS programmer, so please take this suggestion with a grain of salt…
I think having more convenience methods and method chaining available to sprites would be a very useful. Then, this style could be possible for example:
mySprite.setPosition(10,10).scaleX(0.5).rotate(45);