Space Shooter Challenge: Boss Part 4 — Final State and Tidy Up

Space Shooter Challenge: Boss Part 4 — Final State and Tidy UpTo enhance the first encounter, I added in the starting shield to visualize not being able to initially damage the Boss. Then a smaller shield around the “core” of the ship and the Gatling G…


This content originally appeared on Level Up Coding - Medium and was authored by Calum Slee

Space Shooter Challenge: Boss Part 4 — Final State and Tidy Up

To enhance the first encounter, I added in the starting shield to visualize not being able to initially damage the Boss. Then a smaller shield around the “core” of the ship and the Gatling Gun, to allow for separation between the regular states and the final state.

I also added a Script for these two shields, that simply consisted of destroying projectiles on collision, preventing any of the components inside it being damaged. To turn them off and on, I created two GameObject variables in the Boss Script, and used SetActive to pass through true or false where needed.

Next, I needed to set the boss to the next phase if all the turrets were destroyed. I could do this by checking each turret’s health, but I know that the total health left should be 60, therefore I used an If check.

From here, I could enable the boss’s collider, so that anywhere the player hits, damages the boss. Then I could turn off the smaller shield I created earlier, and start the Gatling Fire Routine on top of the standard movements.

To make use of the Boss Collider I needed to create and OnTriggerEnter2D method to check for the various projectiles and destroy them. I opted to have the Super Laser do 1 damage as it can continuously collide.

For the GatlingFireRoutine, I created a new Prefab of 4 lasers, and Instantiated it randomly every 7 to 10 seconds. By this point, the hard part of the boss fight is all but done. The Gatling Fire can instantly kill the player, but it’s not intended to be too difficult for the last few hits.

Lastly, I needed a way to Destroy the Boss. I wanted multiple explosions to occur over the ship, so I created a bunch of empty objects at random points, to hold the location for various explosions. Then I stored them in an Array.

Using a ForEach loop, I could access each location in the array, and then Instantiate my explosion prefab at each.

From here, I called the GameWon method within the Game Manager Script. Which, much like the GameOver method, stops everything from continuing to spawn. It additionally calls a public method in the UI Manager, to display a winning message, before instructing how to restart.

With that, V1.2 of my Space Shooter is complete. Next week, I will be starting on Cinematography in Unity with a project called The Great Fleece. I’m looking forward to it! I have a few ideas to integrate to the Space Shooter at some point in my free time, so be sure to follow it over on Itch.io at the link below.

If you would like to try out my game for yourself. Click HERE!


Space Shooter Challenge: Boss Part 4 — Final State and Tidy Up was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.


This content originally appeared on Level Up Coding - Medium and was authored by Calum Slee


Print Share Comment Cite Upload Translate Updates
APA

Calum Slee | Sciencx (2021-07-17T14:00:16+00:00) Space Shooter Challenge: Boss Part 4 — Final State and Tidy Up. Retrieved from https://www.scien.cx/2021/07/17/space-shooter-challenge-boss-part-4%e2%80%8a-%e2%80%8afinal-state-and-tidy-up/

MLA
" » Space Shooter Challenge: Boss Part 4 — Final State and Tidy Up." Calum Slee | Sciencx - Saturday July 17, 2021, https://www.scien.cx/2021/07/17/space-shooter-challenge-boss-part-4%e2%80%8a-%e2%80%8afinal-state-and-tidy-up/
HARVARD
Calum Slee | Sciencx Saturday July 17, 2021 » Space Shooter Challenge: Boss Part 4 — Final State and Tidy Up., viewed ,<https://www.scien.cx/2021/07/17/space-shooter-challenge-boss-part-4%e2%80%8a-%e2%80%8afinal-state-and-tidy-up/>
VANCOUVER
Calum Slee | Sciencx - » Space Shooter Challenge: Boss Part 4 — Final State and Tidy Up. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/07/17/space-shooter-challenge-boss-part-4%e2%80%8a-%e2%80%8afinal-state-and-tidy-up/
CHICAGO
" » Space Shooter Challenge: Boss Part 4 — Final State and Tidy Up." Calum Slee | Sciencx - Accessed . https://www.scien.cx/2021/07/17/space-shooter-challenge-boss-part-4%e2%80%8a-%e2%80%8afinal-state-and-tidy-up/
IEEE
" » Space Shooter Challenge: Boss Part 4 — Final State and Tidy Up." Calum Slee | Sciencx [Online]. Available: https://www.scien.cx/2021/07/17/space-shooter-challenge-boss-part-4%e2%80%8a-%e2%80%8afinal-state-and-tidy-up/. [Accessed: ]
rf:citation
» Space Shooter Challenge: Boss Part 4 — Final State and Tidy Up | Calum Slee | Sciencx | https://www.scien.cx/2021/07/17/space-shooter-challenge-boss-part-4%e2%80%8a-%e2%80%8afinal-state-and-tidy-up/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.