Flower Power

flowerPower2
Very cool, amirite?

In this post I am going to talk about the patterns for shooting that the boss in our game uses. The patterns that the group came up with were spirals, cones and pulsating circles, you can see some examples of how these turned out in the GIFs below. To go along these patterns I also wanted the boss to be able to increase the complexity of the shooting the closer to death it got.



 

For the first iteration of this script I let the gameobject I wanted to shoot hold an empty gameobject which I then rotated before instantiating a projectile in the wanted direction. This was done a set amount of times every frame, depending on what values were assigned to the script in the inspector. When I this week took on the task to create a boss that would make use of this way of shooting I realized that this certain part of the script needed some refactoring. The “new and improved” version now automatically generate the two transforms needed, thus an empty gameobject holding the script is no longer required. These changes made allowing the boss to change pattern mid fight much simpler of a task. I no longer had to get the script from a child of the gameobject that was to fire the projectiles.

In order to create the patterns I use different variables together with differently structured for loops. The core idea behind them are the same, although they use different methods. For example when “Spiral” is the desired pattern two for loops are ran, one for clockwise and one for counter-clockwise shooting. Both of these loops are ran X amount of times, where X is equal to the amount of spirals you desire. In each iteration of the loop the corresponding transform is rotated with (360°/amount of spirals) before firing another projectile.

In past blog posts I have briefly mentioned that the game we are making is meant to be a bullet hell. Although none of the other enemies feature any “bullet hell”-esque  mechanics we as a team felt that it would be nice to have at least this very iconic feature. We also felt that we wanted to have enemies that acted a bit more special than just moving and shooting, just like all the regular enemies currently do.

 

Lepa out *Mic drop*

 

About Leo Jansson

2016 Programming