kaboom icon indicating copy to clipboard operation
kaboom copied to clipboard

Assigning "solid()" to a circle() object in addLevel throws "Error: failed to get area dimension"

Open losrobbos opened this issue 3 years ago • 2 comments

Version

v2000.2

What browsers are you seeing the problem on?

Chrome

What happened?

If I try to produce a solid circle in a addLevel config, it gives me an error.

Error: failed to get area dimension

The behaviour starts when I assign solid() in the level config to the object. If I switch circle() to a rect() everything works like expected.

But I badly want that solid circle :)

See the code example below...

What's the expected behavior?

Applying "solid()" to a circle object should not result in an error. Instead it should produce a solid circle in the map that we can collide against like hell :)

Minimum reproducable code

Inside an addLevel call:

"e": () => [
      "enemy",
      circle(10),
      area(),
      solid(),
      color(255,0,0)
    ]

Gives: 
Error: failed to get area dimension


If I use a rect() instead of circle() in the example above, everything works fine!

So it is clearly the combination of "circle" and "solid".

Live demo

No response

losrobbos avatar Feb 24 '22 08:02 losrobbos

Alright, I realized that I need to configure the area with concrete values for width & height to eliminate the issue.

But it would be nicer, if either the docs get updated for the "circle()" function here OR to take the circle radius * 2 as default for width & height of the area, in case we apply area() on a circle object. Then the code will not break unexpectedly.

losrobbos avatar Feb 24 '22 08:02 losrobbos

Yeah circle doesn't have automatic area in this version, but will do in the upcoming version

slmjkdbtl avatar Feb 28 '22 16:02 slmjkdbtl

Already fixed for v3000.

lajbel avatar Jan 30 '23 19:01 lajbel