I once again feel like I am wading through muddy waters. Just about everything I try to do at the end of this Framework: Core Programming section ends up taking a lot longer than I think it will running through things in my head. Granted, in my head, things work correctly the first time. I have to remember that I am still learning, so asking for help, researching and trying things that don’t work will be commonplace right now. Today was no different.
Today I dove into learning more about Racasting2D. I referenced some very informative blogs from one of our team leads, Dan. I think some of the final checklist items concerning enemy behavior will be “easier” to finish using Raycasting techniques. While I have yet to get my enemy that is Raycasting to react to the targets being hit, I did manage to get it working and sending a message to my Debug.Log console message. I want my main enemy type that moves down the screen and fires lasers, to be able to shoot a homing missile at the player when it gets “behind” it. I have it shooting two Raycasts, left and right, so as the ship descends it will be able to tell when it is at the same horizontal field as the player. Being that I need to be behind the player, I will need to use the offset mechanic in the Raycast, moving it to the rear of my enemy ship, rather than the default center.
I tried completing an item where “the enemy evades a laser if it is close enough”, and like many items lately, it half-worked. I used a similar function as I did when making my enemy chase the player if it gets close enough. I used the same targeting distance to dictate how close the laser could get. I then used the same calculation asking “if my enemy position is less than the targeting distance from the target tag (laser), move right to evade. It almost works, but I think my issue is coming from the enemy laser being composed of player laser preFabs. Even though I have all of the components tagged as “enemy laser”, my enemy still fires a laser and immediately tries to dodge it’s own shot. The good news here is I know the evade is working, I just need to figure out the target function for the player laser only.
This afternoon we had another awesome all hands meeting with Al. It was a part two to last weeks part one, talking about animations, using the animator, keyframes and referencing parameters through code. I am so grateful for the lessons being shared with us all here at the GameDevHQ internship program, as well as the opportunity to learn and grow into a new field.