I’m trying to make the NPCs in my video game work but this one NPC crashes the game when I talk to him facing any direction except when I face right for some reason. It’s saying it’s an array issue (I don’t have a single array in my whole game) a few hundred lines of code above where the NPC’s code is. How do I fix this?
The fact that only facing right works points to something indexing by direction. Even if you never added an array, MakeCode blocks often create them internally (animation frames, sprite lists, tilemap overlaps, allOfKind). Click the error in the console to jump to the reported line, then switch to JavaScript view to see which block it maps to; the line number refers to compiled code, so it can look hundreds of lines away from the NPC blocks. Check any block that selects an image or animation based on direction, and make sure the index is valid for every direction.
2 Likes
share the project
Interesting… I’m gonna go see if that works. Thanks for the help!