|
LineHitShape | |
State = LineHitShape(X1#, Y1#, X1#, Y2#, ShapeIndex, ShapeX#, ShapeY#, [IntersectFlag=0]) | |
Parameters: X1# = The starting X coordinate of the test line Y1# = The starting Y coordinate of the test line X1# = The ending X coordinate of the test line Y2# = The ending Y coordinate of the test line ShapeIndex = The index of the shape you wish to test ShapeX# = The base X position of the test shape ShapeY# = The base Y position of the test shape [IntersectFlag=0] = Flag to select if should calc the intersection point ( 0=No, 1= Yes) |
|
Returns: State = The hit state of the line (0 = outside of shape, 1 = intersects shape) |
|
The LineHitShape function checks if a line (ray) is inside, or intersects a vector shape. It will return a true (1) when the line intersects, or a false(0) when it does not. The IntersectFlag parameter is optional, it defaults to zero. This parameters selects if the LineHitShape function will calculate the point of impact or not. When it's zero it doesn't, when it's one it'll calculate it. The impact point is reutrned via GetIntersectX# and GetIntersectY# respectively. FACTS: * When detecting the impact point of along the line/ray LineHitShape will find the nearest impact to the x1/y1 coordinate. Mini Tutorial: This example checks if the mouse pointer ever hits a moving shape.
This example outputs, |
Related Info: | BoxHitShape | CircleHitShape | PointHitShape | ShapeHitShape | SpriteCollisionMode : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |