You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-11Lines changed: 38 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,23 +58,32 @@ Then you have to tell the grid how many cells it has by setting the number of ce
58
58
Then you may add your sprites or other objects to the grid by calling `Add(object, Point/Vector2/Rectangle/Rect)` or `Move(object, Point/Vector2/Rectangle/Rect)`. Move removes the item first if it was present on the grid.
59
59
60
60
### Parameters
61
-
The first parameter is your item. The grid is generic and there are no constraints for that.
62
-
The second parameter is always one of the following:
63
-
| Parameter | Description | Info |
64
-
|:----------|:------------|:-----|
65
-
|Point|This is an int-point.|By specifying this you tell the grid you mean the cell at exactly this position.|
66
-
|Vector2|This is a float-vector.|By specifying this you tell the grid that you mean the cell that contains these game-coordinates.|
67
-
|Rectangle|This is a basic int-rectangle. It is not rotated and therefore axis-alinged. So it's an Axis-Aligned-Bounding-Box or AABB.|By specifying this you give the grid a rectangle in the cell-coordinate-system (0-numberOfCellsX, 0-numberOfCellsY).|
68
-
|Rect|This is a special parameter in our utility-package. It's essentially a Rectangle, but with all float parameters.|By specifying this you give the grid a rectangle in the game-coordinate-system.|
69
-
61
+
The first parameter is your item. The grid is generic and there are no constraints for that.
62
+
The second parameter is always one of the following:
63
+
#### Point
64
+
This is an int-point.
65
+
By specifying this you tell the grid you mean the cell at exactly this position.
66
+
#### Vector2
67
+
This is a float-vector.
68
+
By specifying this you tell the grid that you mean the cell that contains these game-coordinates.
69
+
#### Rectangle
70
+
This is a basic int-rectangle.
71
+
It is not rotated and therefore axis-alinged. So it's an Axis-Aligned-Bounding-Box or AABB.
72
+
By specifying this you give the grid a rectangle in the cell-coordinate-system (0-numberOfCellsX, 0-numberOfCellsY).
73
+
#### Rect
74
+
This is a special parameter in our utility-package. It's essentially a Rectangle, but with all float parameters.
75
+
By specifying this you give the grid a rectangle in the game-coordinate-system.
76
+
70
77
All rectangles this grid works with are axis-aligned.
71
78
72
79
You're free to remove them at any time by using one of the remove-methods `Remove(Point/Vector2/Rectangle/Rect)`.
73
80
74
81
The method `Get(Point/Vector2/Rectangle/Rect)` returns an array of your items with all of them that the grid has encountered in the area you've specified when calling `Get`. If it doesn't find any it returns an empty array.
75
82
83
+
If you add your sprites by their position, then this is what the grid will basically do:
76
84
![Position Test][testposition]
77
85
86
+
If you add your sprites by their AABBs, then this is what the grid will basically do:
0 commit comments