-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added: Phaser.Utils.getProperty / Phaser.Utils.setProperty; added: Phase... #1013
Conversation
…aser.Group.checkAll Added deep-property getting and setting via strings: Phaser.Util.getProperty(someObj, 'foo.bar.baz'); Phaser.Util.setProperty(someObj, 'foo.bar.baz', 'lol'); Added a "checkAll" method to Phaser.Group that returns true/false if all of the children's given properties match the value passed in. this.someGroup.checkAll('foo.bar.baz', 'lol'); // will return true if child[n].foo.bar.baz === 'lol' Comes with standard 'force' ability.
|
A few questions/observations about your comments:
|
All valid points. I was thinking from a pure utility function standpoint, like when a game author would use it. Not if it were intended for the core engine implementation. (Example: this["frame"].x = 3 <--- again, misunderstood the intended audience...) |
I am curious as to what your second point meant. I'm imagining something like:
and I have no idea how or what you would do with that? |
I'm going to merge this for now, as it's a non-breaking change and a nice feature to add. We can iterate on it for a 2.1 release. |
added: Phaser.Utils.getProperty / Phaser.Utils.setProperty; added: Phase...
… all children of the Group and is set to the given value (thanks @codevinsky #1013) Group.checkProperty allows you to check if the property exists on the given child of the Group and is set to the value specified (thanks @codevinsky #1013) Phaser.Utils.setProperty will set an Objects property regardless of depth (thanks @codevinsky #1013) Phaser.Utils.setProperty will set an Objects property regardless of depth (thanks @codevinsky #1013) Phaser.Utils.getProperty will get an Objects property regardless of depth (thanks @codevinsky #1013)
...r.Group.checkAll
Added deep-property getting and setting via strings:
Phaser.Util.getProperty(someObj, 'foo.bar.baz');
Phaser.Util.setProperty(someObj, 'foo.bar.baz', 'lol');
Added a "checkAll" method to Phaser.Group that returns true/false if all of the children's given properties match the value passed in.
this.someGroup.checkAll('foo.bar.baz', 'lol'); // will return true if child[n].foo.bar.baz === 'lol'
Comes with standard 'force' ability.