photonstorm
2483cd5df4
Various readonly Body properties flagged as 'readonly' in the jsdocs ( #1643 )
2015-02-26 23:32:14 +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
a7bdce1806
Moved collideSpriteVsTilemapLayer to here.
2015-02-19 05:00:22 +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
0588f95f4c
Body.phase renamed to Body.dirty.
2015-02-17 05:13:36 +00:00
photonstorm
86f05160b7
Removed array length vars and added strict equalities.
2015-02-17 05:13:12 +00:00
photonstorm
8483eac6aa
Removing all use of _cache from all Game Objects.
2015-02-16 17:22:51 +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
photonstorm
d710caed9e
Body.reset now resets the Body.speed value to zero.
2015-02-05 05:12:31 +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
d6ea8fb956
jsdoc updates (spelling mistakes, code formatting, etc)
2015-01-28 17:18:33 +00: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
photonstorm
15d5b54c26
Removed redundant updateTransform call.
2015-01-02 04:15:27 +00:00
Richard Davey
3c4a9720c6
Body updateTransform patch re: #1493 and #1490
2015-01-01 12:33:43 +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
0f207c47a7
Calling P2.Body.destroy or ArcadePhysics.Body.destroy wouldn't null the parent sprite body, causing it to error in the next update (thanks @jonathanhooker #1077 )
2014-08-28 03:44:02 +01: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
Paul Salaets
79f550bc89
updating comments: default color and method name
2014-07-05 18:08:00 -04:00
Paul Salaets
0694dab909
reorder param list to be consistent with comment's ordering and other code
2014-07-05 17:50:13 -04:00
Phaiax
00bf349ff5
Body.enable only exists in Arcade physics, so move conditions concerning this into arcarde
2014-06-30 12:49:53 +02:00
photonstorm
69525799d7
New build files for testing.
2014-06-11 12:46:49 +01:00