"Cannot read property '_parent' of null"?

Got the error message after writing the code:

bullet is a variable for the bullets fired from a gun. If you want a closer look at everything the code editor is shooting.js at

In a nutshell, in firebullets function,bullet is null so it can’t add it to the scene hierarchy.

You are also creating a new entity every frame in update.

In this scenario, you should be creating a new entity every time you fire and attach it to the scene hierarchy.

1 Like

Thanks! While you’re here, though, I noticed that after redoing the code, the bullet spawns at the origin and sits there for a second before despawning. How do I

  1. Set its position to the gun, and
  2. Move it forward?