Commit graph

186 commits

Author SHA1 Message Date
spayton
5b6671a634 removed this.z =0, missed from last push 2014-11-03 20:24:56 +00:00
spayton
b51c162b4d Fixed new groups incorrectly always adding with a z index of 0 2014-11-03 18:19:41 +00:00
photonstorm
08a2b12d7d Tidied up the jsdocs. 2014-10-28 01:48:56 +00:00
photonstorm
35d29170d0 Lots of small jsdoc fixes and DocGen updates. 2014-10-20 00:54:56 +01:00
Richard Davey
bc16c7876f Merge pull request #1187 from codevinsky/feature/group-filter
Group.filter
2014-10-09 14:08:51 +01:00
photonstorm
756561920f Group.ignoreDestroy boolean will bail out early from any call to Group.destroy. Handy if you need to create a global Group that persists across States. 2014-09-18 05:11:48 +01:00
photonstorm
20551f9129 Lots of jsdocs fixes ready for the new doc generator. 2014-09-16 17:35:08 +01:00
Jeremy Dowell
83007878fc updated: Group.filter documentation 2014-09-11 13:09:52 -05:00
Jeremy Dowell
298622f65f added: Group.filter
takes a predicate function and passes child, index, and the entire child array to it.

return an ArrayList containing all children that the predicate returns true for.
2014-09-11 13:06:38 -05:00
photonstorm
f2a8a927f9 Group.addMultiple allows you to pass an array of game objects and they'll all be added to the Group in turn. 2014-09-05 06:01:25 +01:00
photonstorm
fa45d7feff Events.onDestroy is a new signal that is dispatched whenever the parent is being destroyed. It's dispatched at the start of the destroy process, allowing you to perform any additional house cleaning needed (thanks @jonkelling #1084)
Group.onDestroy is a new signal that is dispatched whenever the Group is being destroyed. It's dispatched at the start of the destroy process, allowing you to perform any additional house cleaning needed (thanks @jonkelling #1084)
2014-08-28 02:56:06 +01:00
darfux
abdf54858c Fixed Group.removeBetween's default endIndex bug 2014-08-26 21:02:13 +08:00
Sam MacPherson
3b69c7ede1 group swap fix 2014-08-05 19:39:21 -04:00
photonstorm
24527eac3e Group.checkAll allows you to check if the same property exists across 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)
2014-07-18 11:52:39 +01:00
Richard Davey
3da788bd1d Merge pull request #1013 from codevinsky/group-checkall
added: Phaser.Utils.getProperty / Phaser.Utils.setProperty; added: Phase...
2014-07-18 11:37:38 +01:00
Charles Black
7107d73188 group create with p2 debug 2014-07-14 14:05:44 -04:00
jdowell
aad74ff4d5 added: Phaser.Utils.getProperty / Phaser.Utils.setProperty; added: Phaser.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.
2014-07-14 12:33:13 -05:00
photonstorm
2c421d27ce GameObjectFactory.spriteBatch now lets you specify null as a parameter for the parent and automatically adds the batch to game.world as a result. Also fixed jsdocs issues (@petarov #1000) 2014-07-14 12:56:05 +01:00
photonstorm
2916f0413f Group.bringToTop (and consequently Sprite.bringToTop) no longer removes the child from the InputManager if enabled (thanks @BinaryMoon, fix #928)
Group.sendToBack (and consequently Sprite.sendToBack) no longer removes the child from the InputManager if enabled.
Group.add has a new optional boolean parameter: `silent`. If set to `true` the child will not dispatch its `onAddedToGroup` event.
Group.addAt has a new optional boolean parameter: `silent`. If set to `true` the child will not dispatch its `onAddedToGroup` event.
Group.remove has a new optional boolean parameter: `silent`. If set to `true` the child will not dispatch its `onRemovedFromGroup` event.
Group.removeBetween has a new optional boolean parameter: `silent`. If set to `true` the children will not dispatch their `onRemovedFromGroup` events.
Group.removeAll has a new optional boolean parameter: `silent`. If set to `true` the children will not dispatch their `onRemovedFromGroup` events.
Internal child movements in Group (such as bringToTop) now uses the new `silent` parameter to avoid the child emitting incorrect Group addition and deletion events.
2014-07-02 14:04:14 +01:00
photonstorm
86c228d380 Group.destroy now removes any set filters (thanks @Jmaharman fix #844) 2014-05-26 20:13:00 +01:00
photonstorm
c9656e48de Group.hasProperty fixed to not use hasOwnProperty, but a series of in checks (thanks @mgiuffrida for the idea, #829) 2014-05-19 13:11:58 +01:00
photonstorm
1f24d95e1a New force parameter added to Group.set, setAll, setAllChildren, setProperty which controls if a property is created even if it doesn't exist.
Group.hasProperty will check a child for the given property and return a boolean.
2014-05-01 11:45:17 +01:00
photonstorm
87bcb6677d Group.classType allows you to change the type of object that Group.create or createMultiple makes to your own custom class. 2014-04-23 21:49:58 +01:00
photonstorm
0b1fb5a637 Destroying an object with an input handler during its onDown event would throw Signals dispatch errors (thanks @jflowers45, fix #746)
InputHandler._setHandCursor private var wasn't properly set, meaning the hand cursor could sometimes remain (during destroy sequence for example)
All Game Objects have a new property: destroyPhase (boolean) which is true if the object is in the process of being destroyed, otherwise false.
The PIXI.AbstractFilter is now included in the Phaser Pixi build by default, allowing for easier use of external Pixi Filters.
2014-04-22 01:43:22 +01:00
photonstorm
3e6a88fff6 Group.remove now checks the child to see if it's a member of the root Group before removing it, otherwise Pixi throws an Error. 2014-04-17 12:47:36 +01:00
photonstorm
ce592d48bf Group.destroy checks parent before removing (thanks @clark-stevenson, fix #733) 2014-04-17 12:18:39 +01:00
photonstorm
7c9f079ce5 Group.setProperty will now check if the property exists before setting it, this applies to Group.setAll and anything else using setProperty internally. 2014-04-17 12:11:37 +01:00
photonstorm
089dfbb960 Group.resetCursor will reset the Group cursor back to the start of the group, or to the given index value. 2014-04-16 21:39:04 +01:00
photonstorm
6979103634 Fix for #732 (Timer.onComplete not firing).
jsdoc updates across Math and InputHandler.
2014-04-16 18:50:54 +01:00
photonstorm
f70e4d7d90 Fixed the use of the destroy parameter in Group.removeAll and related functions (thanks @AnderbergE, fix #717) 2014-04-14 12:57:29 +01:00
photonstorm
a01cc2e1ca Objects with an InputHandler now deactivate it when the object is removed from a Group but not destroyed (fix #672)
Lots of jsdoc fixes in Body and World.
Removed un-used events from World (such as onImpact).
2014-04-11 00:06:22 +01:00
photonstorm
770ced8ac1 Group.customSort allows you to sort the Group children based on your own sort function. 2014-04-10 00:56:53 +01:00
photonstorm
b9cb2417b6 Group.removeBetween now properly iterates through the children. 2014-04-09 03:19:36 +01:00
photonstorm
bf32590cfe Fixed a few jsdoc errors. 2014-04-07 12:29:26 +01:00
Richard Davey
eef7cc2d6d Merge pull request #688 from jonthulu/cursorFix
Fixed bug in group.next when cursor is at the last child.
2014-04-03 21:22:43 +01:00
Jon White
0aca0962df Fixed bug when group.remove is called when the cursor is on the last children index. 2014-04-03 10:42:55 -05:00
Jon White
ab3ae750e2 Fixed bug in group.next when cursor is at the last child. 2014-04-03 10:13:27 -05:00
Jon White
e24c8f63ea Fixed bug where move up and move down method in groups did not work. 2014-04-02 15:39:20 -05:00
Richard Davey
06c953a293 Merge pull request #647 from xtian/grunt-jshint
Run jshint as part of build process and fix jshint errors
2014-03-26 15:46:35 +00:00
photonstorm
953ae83350 Updated TS defs (fix #650) 2014-03-26 13:24:11 +00:00
Christian Wesselhoeft
debb6bdcf9 Fix jshint issues in src/core 2014-03-25 14:56:05 -07:00
Christian Wesselhoeft
61f18b675c Trim trailing whitespace. 2014-03-25 14:56:04 -07:00
photonstorm
164f3cbe83 When creating a Sprite (via Group.create or directly) with exists = false and a P2 body, the body is not added to the world. 2014-03-19 13:09:29 +00:00
photonstorm
96365a3a1f The StateManager is now responsible for clearing down input, timers, tweens, physics, camera and the World display list.
Removed the use of Int16Array from all Game Objects, swapped for standard Array. Phaser now runs on Android 2.x again (fix #590)
2014-03-19 12:05:19 +00:00
photonstorm
11fdd62436 World.destroy incorrectly clashed with the Group.destroy method it over-rode, renamed to World.shutdown and updated StateManager accordingly.
World.shutdown now removes all children iteratively, calling destroy on each one, ultimately performing a soft reset of the World.
Objects with a scale.x or y of 0 are no longer considered valid for input (fix #602)
InputHandler will set the browser pointer back to default if destroyed while over (fix #602)
Group.destroy has a new parameter: `soft`. A soft destruction won't remove the Group from its parent or null game references. Default is `false`.
InputHandler.validForInput is a new method that checks if the handler and its owner should be considered for Pointer input handling or not.
Group.replace will now return the old child, the one that was replaced in the Group.
2014-03-19 00:54:49 +00:00
photonstorm
ec2275e18c Group enableBody parameter was incorrectly assigned to the debug var (thanks BurnedToast, fix #565) 2014-03-16 00:45:47 +00:00
photonstorm
fee4d36b91 Group.getAt comparison updated (fixes #578) 2014-03-15 23:53:05 +00:00
photonstorm
0e29bd4300 Tile Collision Callbacks working properly. CSV / Blank map examples added. Multiple tilesets per map working again. That's it folks! 2014-03-14 04:21:56 +00:00
photonstorm
f3ff9c197f Fixed all the tilemap examples. 2014-03-14 03:26:06 +00:00
photonstorm
c8e63582a4 Lots of small tweaks to pass jshint. 2014-03-13 16:49:52 +00:00
photonstorm
39add47ac3 enableBody added to Group constructor. Also: game.add.physicsGroup(Phaser.Physics.ARCADE) is a thing :) 2014-03-13 11:45:55 +00:00
photonstorm
aa6b1821bd Get First Dead example. 2014-03-13 10:14:06 +00:00
photonstorm
94448d2497 P2 postBroadphase example and handler done. Group.enableBodyDebug added. Sprites no longer remove bodies from the world if exists = false, instead they set safeDestroy to true, which removes the body on the next preUpdate, to avoid mid-step destruction issues. 2014-03-13 07:29:23 +00:00
photonstorm
1966bfc0f8 Added in Game.focusLoss and focusGain methods and onBlur and onFocus signals to listen for. Made small time related fix and tested on iOS6 and iOS7 home screen button + lock button and all working fine. 2014-03-12 21:19:00 +00:00
photonstorm
84741f065f New P2 examples. And fixed Camera.atLimit value. 2014-03-12 16:33:53 +00:00
photonstorm
abf26df741 New P2 examples and fixed Body debug assignment parameter. 2014-03-12 06:25:29 +00:00
photonstorm
6ef9e30753 Added z property to remaining game objects and updated TypeScript defs. 2014-03-10 23:16:49 +00:00
photonstorm
53797171a3 Fixed Group.sort. Added z-depth property to all core game objects. Fixed P2 const overwrite. 2014-03-10 23:01:10 +00:00
photonstorm
b4cb281f1c Renamed Phaser.Physics.P2 const to Phaser.Physics.P2JS to avoid issue #540 2014-03-10 22:15:03 +00:00
photonstorm
85d5fdfb2f Sorted out orientationImage in ScaleManager, throwing a preUpdate error (fix #534)
Tightened up the currentFrame allocation in AnimationManager.
2014-03-10 19:06:16 +00:00
photonstorm
9f997daa46 Lots of examples fixes and put Group.sort back in. 2014-03-10 14:33:18 +00:00
photonstorm
8fff38618d Tidied up the Examples, fixed Arcade Physics Body, added Body enable support to Group and fixed QuadTree. 2014-03-10 03:06:28 +00:00
photonstorm
8c2502d37d Group.xy(index, x, y) allows you to set the x and y coordinates of a Group child at the given index.
Group.reverse() reverses the display order of all children in the Group.
New labs demo.
Fixed some Easing docs issues.
2014-03-04 01:27:57 +00:00
photonstorm
67ad898294 Tween.generateData(frameRate) allows you to generate tween data into an array, which can then be used however you wish (see new examples)
Added new Retro Font examples.
2014-03-03 22:43:35 +00:00
photonstorm
8dcfef8db0 Updated to latest Pixi build (can do away with our own local patch now).
Group.sendToBottom(child) is the handy opposite of Group.bringToTop()
Group.moveUp(child) will move a child up the display list, swapping with the child above it.
Group.moveDown(child) will move a child down the display list, swapping with the child below it.
2014-02-28 18:55:07 +00:00
photonstorm
7e12075be1 Buttons are now cleanly destroyed if part of a Group without leaving their InputHandler running.
You can now safely destroy a Group and the 'destroyChildren' boolean will propogate fully down the display list.
Calling destroy on an already destroyed object would throw a run-time error. Now checked for and aborted.
Calling destroy while in an Input Event callback now works for either the parent Group or the calling object itself.
In Group.destroy the default for 'destroyChildren' was false. It's now `true` as this is a far more likely requirement when destroying a Group.
All GameObjects now have a 'destroyChildren' boolean as a parameter to their destroy method. It's default is true and the value propogates down its children.
2014-02-27 20:05:16 +00:00
photonstorm
5ab104ad4b Loader.script now has callback (and callbackContext) parameters, so you can specify a function to run once the JS has been injected into the body. 2014-02-26 02:45:06 +00:00
photonstorm
c53a06849e Stop Group.callAll splitting empty strings. 2014-02-25 05:20:19 +00:00
photonstorm
5f6fc9db05 When adding a Group if the parent value is null the Group won't be added to the World, so it's up to you to add it when ready. If parent is undefined it's added to World. 2014-02-21 12:33:15 +00:00
Georgios Kaleadis
b2303c64a3 endless loop when in Phaser.Group when destroy children fixed (use parent not group) 2014-02-20 13:26:10 +01:00
photonstorm
812de7d994 Fix typos in Phaser.Group#forEachExists for docs #447 2014-02-19 15:06:22 +00:00
photonstorm
e5812710cc Added Spring class. Fixed reason why World wasn't pre and post updating (Stage didn't have an exists property). 2014-02-15 02:19:37 +00:00
photonstorm
e5e643b103 fixedToCamera now works across all display objects. When enabled it will fix at its current x/y coordinate, but can be changed via cameraOffset.
fixedToCamrea now works for Groups as well :) You can fix a Group to the camera and it will influence its children.
Also fixed the issue with World.preUpdate/postUpdate not being called and various small documentation issues.
2014-02-15 01:27:42 +00:00
photonstorm
3e99391cbf Updated all Game Objects so they all have preUpdate, update and postUpdate functions (even if empty). Updated World so when it iterates through them all it no longer checks if those functions are present before calling them. Was wasting a lot of time doing that before. 2014-02-14 01:09:52 +00:00
photonstorm
bdb8908fee Groups now update their children across preUpdate, update and postUpdate.
Sprite.exists = false removes Body from world.
2014-02-13 12:26:39 +00:00
photonstorm
f6113ac6c4 Physics World events added.
Group has new 'addToWorld' parameter, which fulfills the same function as the old useStage.
Stage now extends PIXI.Stage rather than owns one.
2014-02-12 19:45:09 +00:00
photonstorm
4ed20e0f77 Removed all intances of Sprite.group from Group and replaced with the already existing parent property. 2014-02-06 13:15:45 +00:00
photonstorm
8eae8feecc More Group fixes to the new format. Updated list of included Pixi files to remove un-needed ones. 2014-02-06 03:34:27 +00:00
photonstorm
4cfce8b4d2 Group now extends PIXI.DisplayObjectContainer, rather than owning a _container property, which makes life a whole lot easier re: nesting. 2014-02-06 02:31:36 +00:00
photonstorm
0896c2fac7 Updating copyright year and README. 2014-02-05 16:54:59 +00:00
photonstorm
84f0f00f49 n-way collision checks and onBeginContact and onEndContact done and working. Also fixed issue in TweenManager.removeAll. 2014-02-05 16:54:58 +00:00
photonstorm
3488880956 Sprite vs. Sprite Group Body Tests. 2014-02-03 04:09:45 +00:00
photonstorm
011d2d8e05 The way the collision process callback works has changed significantly and now works as originally intended.
The World level quadtree is no longer created, they are now built and ripped down each time you collide a Group, this helps collision accuracy.
Bodies are no longer added to a world quadtree, so have had all of their quadtree properties removed such as skipQuadtree, quadTreeIndex, etc.
QuadTree.populate - you can pass it a Group and it'll automatically insert all of the children ready for inspection.
Removed ArcadePhysics binding to the QuadTree, so it can now be used independantly of the physics system.
2014-01-14 02:43:09 +00:00
photonstorm
428e331a11 Groups can now be added to other Groups as children via group.add() and group.addAt().
Groups now have an 'alive' property, which can be useful when iterating through child groups with functions like forEachAlive.
2014-01-06 01:39:23 +00:00
photonstorm
86f6ddcbc8 Two new particle examples and a group animation example. Also fixed CocoonJS sound issue and Cache sound locked bug. 2013-12-31 03:37:11 +00:00
photonstorm
ba74bea4b4 New Group.destroy example and patched the desyrel font xml. 2013-12-30 21:36:50 +00:00
photonstorm
ce4cf531d4 Added class constructors, fixed Stripshader, added relative Tween example and updated Tween source. 2013-12-30 16:54:00 +00:00
photonstorm
bf72b4d3b0 Tilemap.createFromObjects can now turn a bunch of Tiled objects into Sprites in one single call, and copies across all properties as well. 2013-12-22 04:27:12 +00:00
photonstorm
7917eac255 Added Matching Pairs game and updated fixed to camera example. 2013-12-16 15:16:44 +00:00
photonstorm
669570c701 Tidying up the examples and more Tilemap work. 2013-12-10 12:23:42 +00:00
photonstorm
1f513a333e Fixed an issue where passing null as the Group parent wouldn't set it to game.world as it should have (thanks tito100).
Continued work on the tilemap collision - again, please don't use this version if you need working tilemaps.
2013-12-06 01:07:25 +00:00
photonstorm
cd314cd03e Group.length now returns the number of children in the Group regardless of their exists/alive state, or 0 if the Group is has no children. 2013-12-05 09:14:49 +00:00
photonstorm
42c0bed502 Fixed World.scale and Group.scale. 2013-12-03 02:13:57 +00:00
photonstorm
a9a46bfbbf Lots of documentation updates and new Loader examples. 2013-11-27 16:33:49 +00:00
photonstorm
141337bed9 Heavily optimised PixiShader. 2013-11-26 05:13:56 +00:00
photonstorm
299115ca5d The entire Phaser library has been updated to match the new JSHint configuration. 2013-11-25 04:40:04 +00:00
photonstorm
13a2cc2feb Updating all files to adhere to the JSHint settings and fixing lots of documentation errors on the way. 2013-11-25 03:13:04 +00:00
photonstorm
83cacb93a0 More updates to BitmapData. 2013-11-15 20:40:55 +00:00
photonstorm
3f99b691c9 Added in a Group.sort demo, also updated the documentation and build files. 2013-11-07 06:10:15 +00:00
photonstorm
42cd8bd812 Added Group.sort, can sort the Group based on any given numeric property (x, y, health), finally you can do depth-sorting :) 2013-11-07 04:31:37 +00:00