Random Spawn Outside Camera View
I have a Actor that randomly spawns enemies. Works great over all. The only problem I have is that at times enemies appear right in front of the player. Is their a way to tell the program not to spawn enemies within view?
Best Answer
-
salochin59 Posts: 25
Nevermind. Stupid me. I forgot to revert my spawner to prototype. Now it is working. Thank you
Answers
If you don't want the enemies to be at the edge of the screen but also not near the player, you can constrain game.playerX and game.playerY to the player's location and then in the spawner actor, have a rule that spawns the enemy at x=random(playerX-300,playerX-200) and y=(playerY). Or you can randomize the y value as well... up to you. The -300 and -200 will spawn an enemy at a range of 200 to 300 pixels to the left of the player.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User