Commit graph

36 commits

Author SHA1 Message Date
photonstorm
07ef075e92 Phaser.Line.intersectsRectangle checks for intersection between a Line and a Rectangle, or any Rectangle-like object such as a Sprite or Body. 2016-05-24 02:30:00 +01:00
photonstorm
f40cfbe2ae 2015 - 2016. 2016-04-04 22:16:16 +01:00
photonstorm
11fa0c2690 Docs fix #2310 2016-02-02 16:19:09 +00:00
Richard Davey
7588e123c7 Line.centerOn will position the Line so that its midpoint lays on the coordinates given. 2015-08-07 01:40:37 +01:00
Richard Davey
614b84e2ea * Line.rotateAround allows you to rotate a Line around the given coordinates (in world space)
* Point.rotate uses a faster and simpler rotation function when no distance argument is specified.
* Line.rotate used a calculation method which resulted in the line growing (or shrinking) in length over time, the more it was rotated. The new method never changes the lines length.
2015-08-07 01:35:31 +01:00
photonstorm
8e7b717a50 Line.midPoint will return a Point object where the x and y values correspond to the center (or midpoint) of the Line segment. 2015-08-06 17:10:39 +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
photonstorm
732b80813e Line.rotate allows you to rotate a line by the given amount around its center point. 2015-06-13 05:20:43 +01:00
photonstorm
3daea179fb Line.random will return a random point from anywhere on the Line segment. 2015-06-13 03:04:02 +01:00
photonstorm
67039df214 jsdoc fixes. 2015-03-27 10:47:25 +00:00
photonstorm
a69e53f901 Copyright date change. 2015-02-25 03:36:23 +00:00
photonstorm
e100f2f528 Added in type properties. 2015-02-17 16:38:07 +00:00
Richard Davey
cf83e14e8d Updated Line.reflect to remove intersects check.
Line.normalAngle gets the angle of the line normal in radians.
2015-01-04 12:38:40 +00:00
photonstorm
af15b9b4e7 Line.reflect will calculate the reflected, or outgoing angle of the line and a given line if they intersect. This can be used for Body vs. Line collision responses and rebounds.
Line.normalX and Line.normalY contain the x and y components of the left-hand normal of the line.
Line.fromAngle will sets this line to start at the given `x` and `y` coordinates and for the segment to extend at `angle` for the given `length`.
2015-01-04 05:11:19 +00:00
Richard Davey
eb72e4c581 Fixing jsdoc headers. 2014-09-21 10:28:04 +01:00
photonstorm
20551f9129 Lots of jsdocs fixes ready for the new doc generator. 2014-09-16 17:35:08 +01:00
Federico Omoto
0bdb0bdde5 Unnecessary "if" in Line.fromSprite method 2014-09-09 17:24:36 -03:00
Stuart Lee
8ef5c5e0de fixed arguments 2014-08-22 16:33:42 +01:00
beeglebug
5930a90546 added clone function to Line 2014-08-21 22:36:40 +01:00
Wouter Commandeur
5ebacd0b30 stop travis complaints 2014-06-23 22:59:47 +02:00
Wouter Commandeur
37dcfce628 fix checking of segment intersection no more rounding needed. 2014-06-23 20:25:47 +02:00
Wouter Commandeur
266eb10765 Fix Phaser.Line.intersectsPoints for floating point inaccuracy. Round the result to 3 decimals, should be enough precision and solves the problems.
See: http://www.html5gamedevs.com/topic/6840-phaserlineintersects-does-not-work-for-floats/
2014-05-31 12:13:59 +02:00
Wouter Commandeur
cc102a1924 Fix Phaser.Line.intersectsPoints by properly checking the boundaries 2014-05-01 11:28:00 +02:00
Wouter Commandeur
fbd6d9c33e Fix pointOnLine
Corrected algorithm via: http://stackoverflow.com/questions/11907947/how-to-check-if-a-point-lays-on-a-line-between-2-provided-points
2014-04-30 11:50:01 +02:00
John Watson
27bdbbafaa Fixed Math.atan2 arguments in wrong order
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan2
2014-04-14 17:14:31 -07:00
Christian Wesselhoeft
61f18b675c Trim trailing whitespace. 2014-03-25 14:56:04 -07:00
photonstorm
344ab46d78 Line.fromSprite now sets "fromCenter" to false by default as Sprite.center is deprecated in 2.x. Documentation and Examples updated to reflect this. 2014-03-25 12:44:20 +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
f678d1fd31 Line now has x, y, width, height, top, bottom, left and right properties, so you can effectively get its bounds. 2014-03-14 00:19:45 +00:00
photonstorm
a83a76bc5d Line.coordinatesOnLine will return all coordinates on the line using Bresenhams line algorithm. 2014-03-14 00:05:03 +00:00
photonstorm
9fcab5ef26 Lots of doc fixes (thanks nhowell) 2014-02-20 03:44:44 +00:00
photonstorm
0896c2fac7 Updating copyright year and README. 2014-02-05 16:54:59 +00:00
photonstorm
8e77e8cedb Lots of TypeScript defs updates for the new Physics / Body classes. 2014-02-05 16:54:58 +00:00
photonstorm
45b6d5a741 Removed: Debug.renderSpriteTouching, Debug.renderLocalTransformInfo, Debug.renderWorldTransformInfo, Debug.renderSpriteCollision and Debug.dumpLinkedList.
Debug.renderPhysicsBody(body, color) is extremely useful for debugging the new physics bodies. Will draw the outline + points in the color given.
Debug.renderBodyInfo(sprite, x, y, color) will display lots of Sprite body data.
2014-01-31 05:42:20 +00:00
photonstorm
651858372c Added Game core loop stepping support. Super-useful for debugging, and helped me track down the issue with jittery physics collision. Double-win! 2014-01-29 17:10:13 +00:00
photonstorm
d51a37211c Phaser.Line added to the group of geometry classes, with full point on line/segment and intersection tests (see new examples) 2014-01-29 00:21:28 +00:00