Week 7 - Additional levels and attempts at Advanced Scripting

This week the group were tasked with tackling some advanced scripting topics shown in the following image:

























The group primarily focussed on improving game functionality for this week, so that the game was playable and looked good. This meant an overhaul of the inputs for player movement and the addition of a "Boss Battle". The chosen boss for this battle is a witch, that has three layers of animation, one for hovering, one for horizontal movement across the screen and the last for casting a spell. While no AI pathfinding was used for this battle, a simulated pathfinding was used for the projectile that the witch releases when casting a spell, which moves towards the player by having a small force applied on it in the player's direction, if this spell hits the ground instead of the player then an enemy is spawned that follows the same logic of pathing towards the player. Gameplay testing and all of the attached scripts can be found at the GitHub link at the end of this post.

Some design concepts were used during the scripting of this battle, including the addition of the first "singleton" class which can be defined as a "manager". This manager was handled all of the playing of sounds within the game and looks like:























This manager persists through scene change with the "DontDestroyOnLoad(gameObject)" line within the Awake method, and allows for other scripts to play a sound within the List of sounds attached to the SoundManager. A future improvement to this may be to instead have an "AudioClip" argument to the "PlaySoundEffect" method, but as a design choice the group decided to centralize all sound clips to the SoundManager instead. Passing a string to identify a sound clip rather than the sound clip object itself could be considered less object oriented however.

The in game pause menu was addressed in the previous iteration of our game, along with many coroutines such as:






















This coroutine is for whenever the player takes damage, and fades the sprite of the player in and out over a duration that can be provided, which is a common effect in older games.

That concludes the content for this week's blog post, as with previous weeks, all scripts and, in this case a build, can be found on the github link: https://github.com/KAdams01/JazzJackrabbitComplete/tree/master/2D%20Game

Comments