Need help fixing a "cannot read properties of undefined (reading '_width ')" error

i do not know what the error means, or why it is happening, but I know the code that Is causing it.

in my project I am attempting to draw many small images to a larger image, and make the smaller images rotate around a sprite. I do this using multiple extensions, the sprite utils extension and the scaling extension.

I use a sprite that is placed a set distance from another sprite at a changing angle, then an image is drawn to the sprites position. repeating this fast can make the orbit effect I am attempting, but I also want the image being drawn to be rotated to be facing towards the center object, and for this I use the scaling extension - I have a variable that is an array of rotated images made with the scaling extension, and I choose the image based on the angle from the moving sprite to the center sprite, but this gives me an error for a reason that I cannot figure out.

the code that is not being used is what causes the bug when put into the “get value at” block.

I have tried changing many things with the code block and I keep getting the error, I just don’t know how to fix it.

I do not want to release my project until it is finished, so I will not provide the link to the project.

sorry for the block of text.

1 Like

Do you have 90 images in that ClickerSpriteRotAnim array? 360 degrees / 4 = 90 images or else sometimes it will try to find an image in the array and the array won’t be long enough. This causes it to be “undefined” and the error is saying that “undefined” doesn’t have a “_width” property.

1 Like

yes, it has 90 exactly 90 in the array. I’ve tried setting it to 360 and removing the /4 and that did not work either.

1 Like

ive found out that the error only happens when I use clickerSpritePlacer in the “convert angle from to “

if I replace the variable with another sprite, it does not give me an error, but It gets the angle wrong, obviously.

1 Like

Can you please send your code? Also, try adding a 91st image, or adding a “remainder of (round…) / (90)” so that if the number happens to be 90, it will find image 0.

i dont want to release my project, but the only part that is relevant to this is the part in this screenshot

the only variable shown here that is used anywhere else in my code is “cookie” and it is not the part causing the error