Space game starting bug

Hello! I am a high-school student currently taking AP Computer Science Principles, and as a part of the class, we are allowed to do a project. I stumbled upon Makecode Arcade, and have spent the last month or so toying with it in order to learn how it works. I created a space shooter game that is fully functional. It has a few powerups, and also a superweapon that I am still working on. Just earlier today, I created a custom effect for the game. The game is horizontal, so I used projectiles to simulate stars passing by (the premade effect is only vertical it appears). I resolved this issue, but now when I start the game, I am greeted with a message: "Cannot read properties of null (reading ‘fields’), and there are 3 different places it is appearing. The game will start if I spam the start button enough times, and after that all is well. If anyone could take a look at it, that would be much appreciated. I am looking to export it onto a handheld one of my classmates brought in, and in order to do so I want the game to, well, work. Thanks!

1 Like

This is a pretty late response but it seems to start fine as long as none of the buttons are being pressed when the game loads. It’s only if you press a button at the very start for me.

It seems like the problem goes away if the game starts away with an enemy spawned inside of the screen. This means the error happens since you’re trying to access data of an enemy that hasn’t spawned yet.
P.S, this is a draft of a post I made very long ago, no idea why I never posted it…