2014-03-06 Fourth Artifact
|
Hi This week I have been working on creating and implementing a working enemy movement pattern and a way for waves of enemies to spawn. I will try to do an explanation of how I created the enemy waves in this blog post. I started off with creating a class called EnemyWaves. This class would keep track on the player movement distance and then alarm the enemies that they will spawn when the player had moved a certain distance. Therefore I included the player in the class, and created a function that counted the pixels on the x-axis that the player moved, and a reset-function that would reset this distance to 0 when the player had walked for as far as I decided, and last but not least the alarm that would tell the enemies to spawn. I make them spawn outside of the screen and set their movement pattern to walk into the screen. We have three different enenemies – fire elemental, wood elemental and water elemental. They will have different ways of attacking the player; while the water elemental will stay at far range and shooting the player independently of on which y-axis it stands on since it will be able to shoot diagonally, the fire elemental will stay at medium range trying to follow the players movement up-and down on the y-axis (but it will be slower than the player and will not move until the player have walked a certain distance, therefore it is only following the player within certain limits), and the wood enemy will walk towards the player and fighting it in close range (melee).
Therefore it was very important that I created a Wave-function which makes it able to custom-make each enemy wave exactly as me and my group wants it. It returns a Vector3i to the enemy creator. The x-value will be how many fire elementals to spawn, y-value how many water elemental it will spawn and z-value how many wood it will spawn. How many of each, and how many wave spawns there will be will be balanced later on in the game-making process.
|

A