Good Day everyone! Today I was able to finish up some finishing touches on my ramming enemy. Not to say it didn’t come with some complications. From yesterday I was able to get some movement down, then I figured the easy part can be completed adding audio and an destroy explosion. Here is where I got stuck.
Everything worked but as soon as the enemy was destroyed, he was still there. An Angry ghost rams the player and takes damage. so I looked into my damage script which is pretty ,much the same as the original enemy script. No errors. Ok, lets try “Destroy(gameObject)” instead even though its the same thing. Nope!! Hmmm. The game object is working but why can’t it destroy! I couldn’t figure it out. Reached out for help. As I waited I continued to try an figure it out looking at the script as a whole. Oh! LOL! I didn’t finish cleaning up my code. After finishing the follow and ram movement I had left it in the “Update” method and called the handle in the start. Moved the handle into “Update” and moved the entire script into a new method for movement. Yes! now everything was working.
As I said yesterday, I’m a little rusty. Reason my code is in the update is because I had learned that it is good practice to test it out in the update then create a method when everything is working. Then call the method instead. This leaves the update not so overrun.
Now to get back on to my enemy laser beam which I had been looking at particles to give it a little more detail than just a ray.
See you tomorrow!