I’m making good progress. I now have enemy ships spawning with the asteroid hazards. For some reason that I can’t quite figure out, the shotSpawn location of the enemy ships doesn’t seem to be updating relative to the ships location. Any help is appreciated. I also welcome your feedback on any other aspects of my code and use of the game engine.
Hmmm actually, maybe it’s not a bug. The cloned ship is still pointing to the ‘prefab’ shot spawn. Not the cloned child. Hey, @vaios, what do you think about this? Personally, I don’t see how the current behavior is desired. I guess it should be:
If entity script attribute points to a child entity in a clone operation, point to the cloned child. Otherwise, point to the non-child original.
I’ve implemented your fix but I noticed a weird bug. Even though it looks like enemy shots are now instantiated properly and in the right location, there seems to be some kind of a weird invisible “ghost” instance of every shot that is instantiated along with each shot, in the wrong location. To reproduce the bug, simply start the game and don’t move the player ship. You will notice that as soon as an enemy ship appears on screen and fires a shot, the player ship will blow up. As if the enemy shot was instantiated right on top of the player ship’s position.