Object-spawning in a top-down shooter
|
My name is Guy Dimor, I’m the sole programmer (and therefore lead coder) for Team Wendigo, currently working on the game Umibozu. The biggest challenge for me was finding the right way to spawn enemies. I needed them to come into the screen from all sides. My initial idea was for them to spawn randomly on an ellipse just outside of the game screen and then move in a straight line across the screen. A quick google search landed me an algorithm that produces a random point on a circle. Once the spawn pattern was created, I need to make the enemies move across the screen. The enemies’ only “AI” is moving forward, so I needed I way to make them point towards the screen when instantiated. I initially had them point towards another random point on the same ellipse. However, too many either did not enter the screen or just barely grazed it. I then decided to have that point towards the player’s position at the time of their creation, which indeed caused all of them to enter the screen. However, this meant that the player had to constantly change position to avoid them, as staying static for long guaranteed taking damage. While that is not a bad feature in and of itself, it does go against the goal of having the player not feel stressed. My final idea proved more accurate: Have the enemies move towards a random point inside a rectangle slightly smaller than the screen. This meant all enemies entered the screen, but were more evenly spread-out and did not overwhelm the player. |