Search code examples
javascriptkaboom

Why does the docs for Kaboom.js say that the polygon function say it was added in v3000.2, but v3000.2 doesn't exist?


I was trying to make a polygon in Kaboom, to help with irregular shapes not provided by Kaboom in the regular shape functions, when I get an error stating that 'ERROR: polygon is not defined', even though it is clearly stated in the documentation

I don't believe I need to provide an example, but I will, just in case.

import kaboom from "kaboom"
import "kaboom/global"

kaboom()

add([
  polygon([vec2(0), vec2(50,0), vec2(50), vec2(0,50)]),
  pos(0)
])

with the following error

ERROR: polygon is not defined
    -> code/main.ts:6:0
    -> dist/game.js:4367:3

My biggest problem is that underneath the definition, it says

Since v3000.2

in the documentation, even though v3000.2 hasn't even been published.

Am I missing something?

Edit:

I'm using replit to host and run my code, so that may be the issue


Solution

  • Work fine for me. Are you sure you have the latest version of kaboom installed? What does npm outdated return?

    As for the Since v3000.2, it seems to be just an error in the documentation. Works fine in v3000.17: https://codepen.io/Latcarf/pen/qBwXEKo