kaboom
kaboom copied to clipboard
Incorrect documentation and unusable feature
Version
2000.2.9
What browsers are you seeing the problem on?
Microsoft Edge
What happened?
The documentation states that the Shape type is a union of strings. However, the code says it is a union of classes. On a related note, using a Circle
or Polygon
for the shape
option of area()
does not do anything.
What's the expected behavior?
The documentation should reflect the type, and area()
should support shape
.
Minimum reproducable code
...
add([
rect(16, 16),
area({
shape: new Circle(vec2(0, 0), 1),
}),
origin("center"),
]);
...
Live demo
No response
The code for version 2000.2.9 shows that Shape is a union of strings
https://github.com/replit/kaboom/blob/v2000.2.9/src/types.ts#L3815
But the area()
function always returns a rect
. https://github.com/replit/kaboom/blob/v2000.2.9/src/kaboom.ts#L3651
Yes, only rectangular collisions work in the version 2000.2.9. But as you mentioned in the original post, it's different in master. I imagine it will work very differently in the next release, and for the current release the only potential fix would be to remove other shapes from the documentation.