Labels

Friday, 25 April 2014

Finished Enemy AI and Player Bug Spray

Once movement of the enemies had been scripted the next stage wage was to incorporate the glitched property of the enemies. When the enemies are bugged they cannot be killed by jumping on top of them and instead they must first be sprayed with bug spray to remove the bug to allow the player to destroy them. The enemies also swap textures when they are bugged to an alternate set to visually show the "bug". The code for this for both enemy types is nearly identical so the screen shots below represent the code for both enemies.

Below is a screenshot of what the enemies look like when bugged.



Once the enemy "bugs" had been added the next thing to do was to add the players bug spray as it is required to remove the bugs from the enemies. The bug spray was fairly simple to create and consists of a particle system to depict the spray and a mesh collider to detect whether or not an enemy is colliding with the spray. Below is a screenshot of the player and spray in game as well as a snippet of code that shows how the spray works.




No comments:

Post a Comment