kaboom icon indicating copy to clipboard operation
kaboom copied to clipboard

Incorrect documentation and unusable feature

Open a-a-GiTHuB-a-a opened this issue 2 years ago • 3 comments

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

a-a-GiTHuB-a-a avatar May 23 '22 17:05 a-a-GiTHuB-a-a

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

l8doku avatar Jun 13 '22 14:06 l8doku

But the area() function always returns a rect. https://github.com/replit/kaboom/blob/v2000.2.9/src/kaboom.ts#L3651

a-a-GiTHuB-a-a avatar Jun 18 '22 15:06 a-a-GiTHuB-a-a

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.

l8doku avatar Jun 19 '22 11:06 l8doku