Elemental Code Help

my code for the game I’m working on “Elemental“ keeps throwing an error and I can seem to find it

@WoofWoof Pls help I will offer cat food for it(this is also my first game in js)

If you hover over it in debug mode, you can see that the error is something about a failed “_width” property read on “null”, so something that should have a “width” is probably actually null, and yeah looking at the code I can see an " img`` " line, which fails to create an image because there’s no data inside and outputs null:


So the easy solution is just to turn it into a 1x1 image containing a single transparent pixel by writing " img`.` " instead!

well one way you can understand js betters is you will see where a block is and when you go into js you can still drag the command like a block into your project

I never used those but I fixed it thank you though

in the code I havent used those so it should even get referenced but I think i fixed it

You were referencing the 6th one because your loop was going “i <= 5” which runs 6 times because #5 is included, whereas “i < 5” would run only 5 times as intended. I would recommend only using < and not <= in the future to avoid confusion.