photonstorm
41f81d39b7
jsdocs update (and removed isCircle switch)
2016-04-18 16:17:47 +01:00
photonstorm
ac4acfb912
Removed Arcade Physics Circle support (now in its own branch) ready for 2.4.7 release.
2016-04-14 13:23:28 +01:00
photonstorm
4d8753e9ce
Tidying up for 2.4.7.
2016-04-14 12:57:05 +01:00
photonstorm
aad499b025
Tidying up the code base for 2.4.7.
2016-04-14 12:43:10 +01:00
photonstorm
f4277efc20
Alternative snooker-ball like collision test.
2016-04-11 16:43:17 +01:00
photonstorm
3c4e63fda5
World.separateCircle is working with circle vs. circle bodies.
2016-04-08 03:37:49 +01:00
photonstorm
d009b8d769
Circle vs. Circle rebound code started.
2016-04-07 19:32:27 +01:00
photonstorm
cc5361dd6d
World.separate has been optimized to cut down on the number of calls to intersect
from 3 calls per Game Object collision check, to 2. So if you were colliding 50 sprites it will reduce the call count from 150 to 100 per frame. It also reduces the calls made to seperateX
and seperateY
by the same factor.
...
Two immovable bodies would never set their overlap data, even if an overlap only check was being made. As this is useful data to have this has been changed. Two immovable bodies will still never separate from each other, but they _will_ have their `overlapX` and `overlapY` properties calculated now.
2016-04-07 18:04:45 +01:00
photonstorm
50e126f59e
* Body has two new properties: left
and top
. These are the same as Body.x
and Body.y
but allow you to pass the Body to geometry level functions such as Circle.contains.
...
* Body.setCircle allows you to define a Body as using a circle to collide with instead of a rectangle. You can set the radius of the collision circle and an offset.
* Body.render now renders both circle and rectangle body shapes to the Debug canvas.
* World.intersects has been updated to support both circle and rectangle body shapes, and supports quick-paths for circle vs. circle and rect vs. rect checks.
* World.circleBodyIntersects is a new method that checks for intersection between a Body that has been defined as a circle, and a normal rectangle based Body. This is used internally by World.intersects, but exposed for direct calls as well.
2016-04-07 17:01:16 +01:00
photonstorm
f40cfbe2ae
2015 - 2016.
2016-04-04 22:16:16 +01:00
Richard Davey
5801f1aa15
jshint fixes.
2016-02-04 23:39:58 +00:00
photonstorm
a7c360425f
Tidying up code and docs.
2016-02-04 16:23:40 +00:00
Richard Davey
a8b04c4bf1
Merge pull request #2171 from mattrick16/dev
...
Add method to angle Display Objects relative to world
2016-02-04 18:21:14 +02:00
Jonathan Janisch
24c85dbb35
Inconsistency in arcade.collide processCallback param order #667
2015-10-27 23:48:14 -04:00
mattrick
8843a4ad09
Add worldAngleToPointer
2015-10-27 16:55:23 -07:00
Richard Davey
a56cd31638
jsdoc updates.
2015-07-31 18:39:37 +01:00
photonstorm
858ad51610
Phaser 2.4 release.
2015-07-22 15:31:30 +01:00
photonstorm
f15fe6706c
All undefined argument checks were changed from if (typeof x === 'undefined')
to if (x === undefined)
removing the typeof check and saving some bytes across the codebase in the process.
2015-07-22 10:37:15 +01:00
Richard Davey
9e38bf974a
World.stateChange is a new method that is called whenever the state changes or restarts. It resets the world x/y coordinates back to zero and then resets the Camera.
...
Sprites with Arcade Physics bodies that had `collideWorldBounds` enabled would be moved to the wrong position if you restarted a State (or swapped to a new State) that reset the world bounds (thanks @vulvulune #1775 )
2015-07-22 01:24:26 +01:00
Casey Clyde
e935df328d
Sprite vs Tilemap can now check for overlap, without trying to separate
2015-05-23 22:39:12 -07:00
photonstorm
432516fa0f
Physics.Arcade.sort has a new property 'sortDirection'. If not specified it will use World.sortDirection. If the Group given as the first parameter has its physicsSortDirection
property set that will override any other setting.
...
Physics.Arcade.sort now calls one of four functions: sortLeftRight, sortRightLeft, sortTopBottom and sortBottomTop. Each of which takes 2 Sprites as arguments.
Physics.Arcade.sort now doesn't bail out if the Group contains a mixture of physics and non-physics enabled objects, as the Group hash is now only ever populated with physics enabled objects. Also the sort comparison functions no longer return -1 if the bodies are invalid, but zero instead (#1721 )
2015-04-13 16:29:34 +01:00
photonstorm
77eaa7e707
Optimised World.collideHandler and added SORT_NONE option.
2015-03-23 15:05:57 +00:00
photonstorm
f99f182a6f
Arcade Physics is now using a spacial pre-sort for all Sprite vs. Group and Group vs. Group collisions. You can define the direction the sort will prioritise via the new sortDirection
property. By default it is set to Phaser.Physics.Arcade.LEFT_RIGHT
. For example if you are making a horizontally scrolling game, where the player starts on the left and moves to the right, then this sort order will allow the physics system to quickly eliminate any object to the right of the players bounds. This cuts down on the sheer volume of actual collision checks needing to be made. In a densely populated level it can improve fps rate dramatically.
...
There are 3 other directions available (`RIGHT_LEFT`, `TOP_BOTTOM` and `BOTTOM_TOP`) and which one you need will depend on your game type. If you were making a vertically scrolling shoot-em-up then you'd pick `BOTTOM_TOP` so it sorts all objects above and can bail out quickly.
More importantly you can switch the `sortDirection` at run-time with no loss of performance. Just make sure you do it *before* running any collision checks. So if you had a large 8-way scrolling world you could set the `sortDirection` to match the direction the player was moving in and adjust it in real-time, getting the benefits as you go. My thanks to Aaron Lahman for inspiring this update.
2015-02-26 21:24:07 +00:00
photonstorm
03a2db18cb
Added extra protection in the case of mixed-type Groups.
...
Removed window vars and replaced with stats property.
Removed redundant if/else checks.
2015-02-25 06:06:40 +00:00
photonstorm
8aec760cd5
First pass at spacial sorting in World.collide.
2015-02-25 05:39:02 +00:00
photonstorm
a69e53f901
Copyright date change.
2015-02-25 03:36:23 +00:00
photonstorm
dee13d52d8
jshint fix.
2015-02-25 02:50:57 +00:00
photonstorm
c799dfe7da
Fixed physics postUpdate issue causing particles and all kinds of things to go awry.
2015-02-25 02:18:05 +00:00
photonstorm
3d399f1b14
Removed the final few private vars from computeVelocity
2015-02-25 00:04:53 +00:00
photonstorm
42b316473d
jsdoc fix.
2015-02-23 13:58:57 +00:00
photonstorm
eb732e1d90
Refactored ArcadePhysics.World to remove global property use and array length caches.
2015-02-19 04:59:55 +00:00
photonstorm
052b9a7e06
Separated the Tilemap specific code from World.
2015-02-17 15:49:53 +00:00
photonstorm
4bb1adcf36
Typo fix.
2015-02-17 06:00:18 +00:00
photonstorm
86f05160b7
Removed array length vars and added strict equalities.
2015-02-17 05:13:12 +00:00
photonstorm
18ff04810f
ArcadePhysics.distanceToPointer now calculates the distance in world space values.
...
ArcadePhysics.moveToPointer no longer goes crazy if the maxTime parameter is given and the Sprite is positioned in a larger game world (thanks @AnderbergE #1472 )
2015-02-10 22:16:35 +00:00
photonstorm
816a80f39a
If Body.customSeparateX
or customSeparateY
is true
then the Body will no longer be automatically separated from a **Tilemap** collision or exchange any velocity. The amount of pixels that the Body has intersected the tile is available in Body.overlapX
and overlapY
, so you can use these values to perform your own separation in your collision callback ( #992 )
2015-02-10 12:58:12 +00:00
Richard Davey
9efca46021
Merge pull request #1582 from micahjohnston/dev
...
Fix doc comment on Phaser.Physics.Arcade#getObjectsAtLocation.
2015-02-03 20:45:33 +00:00
zekoff
0ccd225e08
Allow max of 0 in computeVelocity
...
Previous method of setting default max did not allow falsey values.
2015-02-03 11:36:53 -06:00
Micah Johnston
34d443153f
fix argument name in comment on Phaser.Physics.Arcade#getObjectsAtLocation.
2015-01-30 05:48:34 -07:00
Micah Johnston
401d2fe847
Fix doc comment on Phaser.Physics.Arcade#getObjectsAtLocation.
2015-01-29 18:13:03 -07:00
photonstorm
587c3e5f6a
Arcade.Body.friction
allows you to have more fine-grained control over the amount of velocity passed between bodies on collision.
2015-01-18 12:24:00 +00:00
photonstorm
0f42b530eb
Physics.Arcade.isPaused
allows you to toggle Arcade Physics processing on and off. If true
the Body.preUpdate
method will be skipped, halting all motion for all bodies. Note that other methods such as collide
will still work, so be careful not to call them on paused bodies.
2015-01-10 00:30:02 +00:00
photonstorm
8cd98e2e36
jsdocs fixes.
2015-01-05 10:59:10 +00:00
Paul
dab8772de0
Documentation - consistency updates
...
- Updated `readOnly` doclet to `readonly`
- `array` refined to `type[]`, where such information was immediately
determinable.
- Updated {Any}/{*} to {any}; {...*} is standard exception
- Udated {Object} to {object}
2014-11-30 04:03:35 -08:00
Pete Baron
bc70ce74b5
Minor logic fix to nested loop counters.
2014-11-12 15:00:26 +13:00
Pete Baron
1c7059ea6c
Merge remote-tracking branch 'phaser-github/dev' into dev
...
Conflicts:
src/animation/FrameData.js
src/core/Game.js
src/particles/arcade/Emitter.js
src/time/Time.js
src/tween/Tween.js
2014-11-12 13:03:52 +13:00
Pete Baron
af09290cbf
Add getObjectsAtLocation method in Arcade physics.
2014-11-12 11:24:38 +13:00
photonstorm
8bf93fb658
ArcadePhysics.skipQuadTree is now set to true
by default. A QuadTree is a wonderful thing if the objects in your game are well spaced out. But in tightly packed games, especially those with tilemaps or single-screen games, they are a considerable performance drain and eat up CPU. We've taken the decision to disable the Arcade Physics QuadTree by default. It's all still in there and can be re-enabled via game.physics.arcade.skipQuadTree = false
, but please only do so if you're sure your game benefits from this.
2014-11-11 01:05:58 +00:00
DanX
3a1ec3c5c1
Fix docs for collide and collideHandler
2014-09-26 22:37:11 -03:00
photonstorm
20551f9129
Lots of jsdocs fixes ready for the new doc generator.
2014-09-16 17:35:08 +01:00
Carlos Martinez
ec9a8b6903
Firxed for travis build.
2014-09-01 15:03:29 +01:00
Carlos Martinez
9843818f30
Merge branch 'dev' of https://github.com/photonstorm/phaser into dev
2014-09-01 14:19:50 +01:00
Carlos Martinez
0640cc0c03
Added support to pass 2 array in Arcade collide and overlap (response to an issue).
2014-09-01 14:01:36 +01:00
photonstorm
070e33f1e7
ArcadePhysics.overlap has been updated so that the Body.overlapX/Y properties are set to the amount the two bodies overlapped by. Previously they were zero and only populated during the separation phase, but now the data is available for just overlap checks as well. You can then use these values in your ovrelap callback as required - note that they are changed for every check, so a Sprite overlap tested against 10 other sprites will have the overlapX/Y values updated 10 times in a single collision pass, so you can only safely use the values in the callback ( #641 )
2014-09-01 03:54:55 +01:00
photonstorm
69b9e5eb7c
Arcade.overlap and collide are now more consistent about allowing a Group vs. Group or Group vs. Array of Groups set (thanks @pyromanfo #877 #1147 )
2014-08-29 01:28:43 +01:00
Allen Cook
5a3eeb8a9c
Fix for group vs group within group collision ( fixes #877 )
2014-08-28 20:23:02 -04:00
photonstorm
36ecd81f29
Arcade Physics Body.skipQuadTree is a new boolean that if set to true
when you collide the Sprite against a Group it will tell Phaser to skip using a QuadTree for that collision. This is handy if this Body is especially large.
...
Arcade Physics World.skipQuadTree will disable the use of all QuadTrees in collision methods, which can help performance in tightly packed scenes.
2014-08-04 13:04:11 +01:00
Charles Black
a90ab2e59b
P2 bounds now collides with everything by default
2014-07-27 16:06:55 -04:00
photonstorm
2293b64c94
Removing debug / console.log output.
2014-07-09 05:49:13 +01:00
photonstorm
69525799d7
New build files for testing.
2014-06-11 12:46:49 +01:00
Richard Davey
13700148fb
Merge pull request #891 from aivins/issue890
...
Separate from TilemapLayer after custom callbacks.
2014-06-11 00:00:20 +01:00
Lewis Lane
a16cb3f5a2
Added notes to overlap/collide regarding non-recursiveness
...
Made it clear that the overlap and collide methods do not recursively check for collisions, i.e. in the case of being passed a Group containing other Groups or Tilemaps.
2014-06-09 08:05:23 +01:00
Andrew Ivins
ccd914620d
Separate from TilemapLayer after custom callbacks.
2014-06-09 14:28:14 +08:00
photonstorm
9c35dfde0c
ArcadePhysics.Body has a new boolean property enable
. If false
the body won't be checked for any collision or overlaps, or have its pre or post update methods called. Use this for easy toggling of physics bodies without having to destroy or re-create the Body object itself.
2014-05-27 11:22:58 +01:00
photonstorm
2b40c8a7c7
Pointer.type and Pointer.exists properties added.
...
QuadTree.retrieve can now accept either a Sprite with a physics body or a Phaser.Rectangle as its parameter.
ArcadePhysics.getObjectsUnderPointer will return all children from a Group that overlap with the given Pointer.
2014-05-06 02:45:10 +01:00
photonstorm
713bd203ee
ArcadePhysics.collideSpriteVsGroup checks if Sprite has a body before carrying on, now safely skips sub-groups or other non-Sprite group children.
...
QuadTree.retrieve now checks to see if the given Sprite has a body before carrying on.
2014-04-17 12:31:14 +01:00
photonstorm
9762bff5eb
Updated docs to specify callback parameter order ( #667 )
2014-04-01 00:50:24 +01: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
fc0e239719
ArcadePhysics.Body preUpdate has been modified to stop Sprites with non-1 scaling from gaining delta and moving off the screen ( fix #644 ).
...
Lots of ArcadePhysics.World methods have been marked as private where they shouldn't be called directly (separateX, etc)
2014-03-26 10:48:30 +00:00
Christian Wesselhoeft
5f267baeb0
Fix jshint issues in src/physics/arcade
2014-03-25 14:56:04 -07:00
Christian Wesselhoeft
61f18b675c
Trim trailing whitespace.
2014-03-25 14:56:04 -07:00
photonstorm
26a89f0b84
New build files with tilemap callback fixes in.
2014-03-24 01:39:09 +00:00
photonstorm
b9fcda73ca
ArcadePhysics.World.seperate will now check gravity totals to determine separation order. You can set World.forceX to true to always separate on X first and skip this check.
2014-03-21 11:22:56 +00:00
photonstorm
634b1d1093
Emitter.friction property removed and replaced with Emitter.particleDrag, which is now correctly applied.
...
ArcadePhysics.Body.reset incorrectly set the Body.rotation to Sprite.rotation instead of angle.
Emitter.emitParticle resets the rotation on the particle to zero before emitting it.
Lots of fixes to the TypeScript definitions file (thanks as always to clark-stevenson for his tireless work on these)
Emitters now bring the particle they are about to emit to the top of the Group before doing so. Avoids particles hidden behind others.
ArcadePhysics.Body.setSize corrected to take the parameters as positive, not negative values.
ArcadePhysics.Body now checks the Sprite scale automatically and adjusts the body size accordingly (fix #608 )
Emitter.particleClass can now be set to any object that extends Phaser.Sprite, which will be emitted instead of a regular Sprite.
2014-03-20 03:48:54 +00:00
photonstorm
684ee9c064
ArcadePhysics.Body has a deltaMax object, which allows you to cap the delta applied to the position to +- this value.
...
ArcadePhysics.Body now checks the Sprite scale automatically and adjusts the body size accordingly (fix #608 )
2014-03-20 00:20:02 +00:00
photonstorm
0a42ac39b9
ArcadePhysics.World now has a checkCollision object which can be used to toggle collision against the 4 walls of its bounds.
2014-03-19 04:03:21 +00:00
photonstorm
2cc1a45f9a
Fixed SpriteBounds camera placement in Debug (again).
...
Removed un-needed cache vars from ArcadePhysics.World.
Tidied up ArcadePhysics.Body and fixed rotation parameters.
Every single Arcade Physics Example now runs perfectly under this release.
2014-03-19 03:55:44 +00:00
photonstorm
79ffda3f18
ArcadePhysics.separate doesn't pass over to seperateX/Y if overlapOnly is true ( fix #604 )
...
ArcadePhysics.collideSpriteVsSprite checks if both objects have bodies before processing.
ArcadePhysics.Body now checks the ArcadePhysics.World bounds, not the game bounds.
ArcadePhysics.Body has reverted to the 1.1.3 method of preUpdate, so you can now position sprites with x/y, drag them, etc, regardless of the Body.moves flag (issue #606 )
ArcadePhysics.World now has setBounds and setBoundsToWorld methods, which are called automatically on world resizing.
ArcadePhysics.Body no longer sets the offset to match the anchor.
2014-03-19 02:28:20 +00:00
photonstorm
9490041c79
ArcadePhysics.separate doesn't pass over to seperateX/Y if overlapOnly is true ( fix #604 )
...
ArcadePhysics.collideSpriteVsSprite checks if both objects have bodies before processing.
2014-03-19 02:05:29 +00:00
photonstorm
b9ac0d565e
Fixed Tile callback check in Arcade Physics ( fix #562 )
2014-03-16 00:53:50 +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
017a017b96
TilemapLayer.getRayCastTiles will let you get all tiles that hit the given line for further processing.
...
Fixed Tilemap collision. Added new TILE_BIAS const to aid with fast/small sprites.
2014-03-14 02:33:58 +00:00
photonstorm
ec0b22268d
Added Body.tilePadding to help with small/fast moving bodies vs. tile collision.
2014-03-13 23:15:32 +00:00
photonstorm
5297497632
Tilemap collision finally getting closer.
2014-03-13 22:49:08 +00:00
photonstorm
e955145707
Added p2 kill and reset test + nearing completion on tilemap collision.
2014-03-13 21:14:18 +00:00
photonstorm
c8e63582a4
Lots of small tweaks to pass jshint.
2014-03-13 16:49:52 +00:00
photonstorm
e9ae465272
Sorted out Body gravity settings and updated the example.
2014-03-11 16:26:03 +00:00
photonstorm
384451bef7
Particles back in and working again. Also updated most of the examples and put Body.gravity back in as well.
2014-03-11 02:49:55 +00:00
photonstorm
a6467f9b60
Fixed Arcade, Ninja and P2 enable methods. Modified core Physics enable. Added world enable test.
2014-03-11 01:11:08 +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
4db1fc0079
Restored Phaser.QuadTree - should get all remaining Arcade Physics examples working again.
2014-03-07 15:14:53 +00:00
photonstorm
3e93f24583
New split physics system is implemented. Still tidying-up, but ArcadePhysics, P2 and Ninja Physics are in and configured. Lots more examples required, and tilemap collision mostly broken in Arcade at the moment. Time to implement in Ninja.
2014-03-06 06:29:19 +00:00
photonstorm
2bab4fd2fb
Testing lines.
2014-03-05 04:40:37 +00:00
photonstorm
12a2a2ec16
Testing map collision
2014-03-05 03:18:24 +00:00
photonstorm
22b1ce9b9d
Added Phasers new Physics Manager and restored the pre-1.1.4 ArcadePhysics system. The new manager can handle multiple physics systems running in parallel, which could be extremely useful for lots of games.
2014-03-05 02:36:08 +00:00