First, I developed a projectile manager that would handle any and all projectiles that a guard may use. This would provide a method to create and delete any projectiles that belong to a particular guard.
Second, I implemented a hit detection method for the projectiles. Every projectile would check, every update cycle, whether any of the current player's were colliding with it. The function would return true if a player was colliding with it, and false otherwise.
As of now, it works pretty well. I added a timer so the AI would only fire a projectile every x seconds, and it seems to work well in testing. I did have some problems manipulating the angle of the projectile at first, but I worked it out to face properly. I'll be refining this system to include all types of projectiles, and to compute smarter paths over the next week.
No comments:
Post a Comment