Yet another week purely dedicated to implementation of new stuff. Unless you count the few art side-projects I did as well.
Added static plant-like enemy that shoots spells that can affect the player. A red fire shooting one and a blue ice shooting one for now. I may later add one that shoots spikes or something. I scripted the enemy so that you can set the delay between shots and it loops through two frames of the animation for as many times as the delay number, then it shoots its projectile. This is useful to varying difficulty. The projectiles also have a modifiable range.
Added skeleton enemy. He can be effected by ice and fire and kills the player if touched. The skeleton has 3 animations idle, walking, and dying.
AI: For now the AI for the skeleton is fairly simple. There is a variable that dictates its vision range. It shoots out a raycast in the direction of the wizard with length equal to its vision range. If the ray hits the wizard then the skeleton walks in the direction of the wizard. If the wizard is in the other direction the image flips horizontally and walks in the other direction.
Dormant Skeleton: There is another object called dormant skeleton that appears still and lying on its back. When you hit it with lightning it destroys and is replaced by a walking skeleton who behaves normally.
Casting Fire and Ice On Yourself
This change resulted in the added code for allowing a fire monster projectile to kill you. When you are hit by an enemy fireball you catch on fire and die. This is implemented by calling the cast fire on self method when you are shot with it. The problem is there was no such method so I added it. Now as a result if you cast fire on yourself when you are not frozen you catch on fire and die. Additionally if you are on fire for any reason you can extinguish yourself by casting ice on yourself.
Added the second world into the menu. The set of buttons is a child of a parent object called worldBar that contains the buttons and journalButtons for both world1 and world2. World 2 is located 10 units to the right on of world1. I’ve added an arrow to world1 which when pressed, animates the worldbar to shift to the left exposing world2. There is an arrow on world2 that does the same thing.
I’ve also added an option to the settings menu that unlocks all levels for testing purposes.
Added an audio track for the cave levels. Edited the world1 and world2 audio so that it is much shorter and loops. I also compressed all of the audio tracks. The end result is about a 3mb reduction in the app size even after adding the new audio track for world2
The main bug that I fixed this week was a problem with the spell change not registering quickly enough. If the player for example used fire to melt himself and then immediately switched to air and jumped he would end up burning himself because the change did not register fast enough. To solve this I edited the tk2dButton class and made it so that sending the message to its target was the first thing that it does. I also moved the spell casting code into lateUpdate() so that it doesn’t execute until after all the code in the update method executes.
Not only does this prevent you from accidentally killing yourself by tapping to quickly, but also increases the speed at which you can switch between spells. All in all a very important fix.