mirror of
https://github.com/photonstorm/phaser
synced 2024-12-03 18:10:10 +00:00
1 line
9.9 KiB
JSON
1 line
9.9 KiB
JSON
|
{"class":{"name":"Phaser.Line","extends":"","static":false,"constructor":true,"parameters":[{"name":"x1","type":["number"],"help":"The x coordinate of the start of the line.","optional":true,"default":"0"},{"name":"y1","type":["number"],"help":"The y coordinate of the start of the line.","optional":true,"default":"0"},{"name":"x2","type":["number"],"help":"The x coordinate of the end of the line.","optional":true,"default":"0"},{"name":"y2","type":["number"],"help":"The y coordinate of the end of the line.","optional":true,"default":"0"}],"help":"Creates a new Line object with a start and an end point."},"consts":[],"methods":{"public":[{"name":"clone","static":false,"returns":{"types":["Phaser.Line"],"help":"The cloned Line object."},"help":"Returns a new Line object with the same values for the start and end properties as this Line object.","line":190,"public":true,"protected":false,"private":false,"parameters":[{"name":"output","type":["Phaser.Line"],"help":"Optional Line object. If given the values will be set into the object, otherwise a brand new Line object will be created and returned.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"coordinatesOnLine","static":false,"returns":{"types":["array"],"help":"An array of coordinates."},"help":"Using Bresenham's line algorithm this will return an array of all coordinates on this line.\\nThe start and end points are rounded before this runs as the algorithm works on integers.","line":135,"public":true,"protected":false,"private":false,"parameters":[{"name":"stepRate","type":["number"],"help":"How many steps will we return? 1 = every coordinate on the line, 2 = every other coordinate, etc.","optional":true,"default":"1"},{"name":"results","type":["array"],"help":"The array to store the results in. If not provided a new one will be generated.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"fromSprite","static":false,"returns":{"types":["Phaser.Line"],"help":"This line object"},"help":"Sets the line to match the x\/y coordinates of the two given sprites.\\nCan optionally be calculated from their center coordinates.","line":65,"public":true,"protected":false,"private":false,"parameters":[{"name":"startSprite","type":["Phaser.Sprite"],"help":"The coordinates of this Sprite will be set to the Line.start point.","optional":false,"default":null},{"name":"endSprite","type":["Phaser.Sprite"],"help":"The coordinates of this Sprite will be set to the Line.start point.","optional":false,"default":null},{"name":"useCenter","type":["boolean"],"help":"If true it will use startSprite.center.x, if false startSprite.x. Note that Sprites don't have a center property by default, so only enable if you've over-ridden your Sprite with a custom class.","optional":true,"default":"false"}],"inherited":false,"inheritedFrom":""},{"name":"intersects","static":false,"returns":{"types":["Phaser.Point"],"help":"The intersection segment of the two lines as a Point, or null if there is no intersection."},"help":"Checks for intersection between two lines.\\nIf asSegment is true it will check for segment intersection.\\nIf asSegment is false it will check for line intersection.\\nReturns the intersection segment of AB and EF as a Point, or null if there is no intersection.\\nAdapted from code by Keith Hair","line":429,"public":true,"protected":false,"private":false,"parameters":[{"name":"a","type":["Phaser.Line"],"help":"The first Line to be checked.","optional":false,"default":null},{"name":"b","type":["Phaser.Line"],"help":"The second Line to be checked.","optional":false,"default":null},{"name":"asSegment","type":["boolean"],"help":"If true it will check for segment intersection, otherwise full line intersection.","optional":true,"default":"true"},{"name":"result","type":["Phaser.Point"],"help":"A Point object to store the result in, if not given a new one will be created.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"intersectsPoints","static":false,"returns":{"types":["Phaser.Point"],"help":"The inters
|