System error (Javascript)

I keep getting this error saying:

“Cannot read properties (reading "_width”)

I don’t know what’s causing it, I checked with Gemini (our school doesn’t allow any other) and he doesn’t help.

Code: https://arcade.makecode.com/S69775-13061-06736-37658

2 Likes

@BiiTheBee this is happening because of how you are referencing your assets. you can’t call assets.image() like a function, it’s meant to be used as a tagged template literal like this:

assets.image`imageName`

if you do want to look up the images programmatically by name like you’re doing, use helpers.getImageByName() instead

edit: fixed the function name (getImageByName is in the helpers namespace, not assets)

1 Like

I updated my code but the error still occurs, maybe it has something to do with the image?

@BiiTheBee it works for me:

are you sure you replaced it everywhere?

makecode has its own type of javascript that ai doesnt know, you would have to train the ai how to use makecode