I was really lacking motivation this week. I wasn’t as
distracted as last week but it was really difficult to get anything done. On Wednesday
I made a basic enemy this week. This enemy doesn’t move probably one of the
things that makes it basic. It is a stationary ranged attack enemy that fires
at the player. I took a Udemy course on Unity like a year ago. One of the
things that I did not understand about this course was why they made the enemy
object determine the projectile’s path.
In
my opinion it is far easier to give the projectile ‘directions’ than have the
enemy object pass said information to the projectile. I don’t think my way of
doing things is wrong but there may in fact be something that I have yet to understand.
My enemy’s tiny AI brain
works something like this.
AI: Is the player within firing range? Yes or No.
If No do nothing.
If Yes count down until it is time to fire by spawning
projectile object. Then reset time to fire.
Then the Projectile asks: What side is the player on
relative to the Projectile’s position? Then head in the direction toward the
player.
The thing that was strange was how easy all of this was. All
of it was really easy to make. A lot of the starting properties of the enemy were
created using existing pieces of code. Slap my target code and deal damage code
onto this new thing and bang instant enemy. Then same thing for the projectile and
instant projectile by creating a modified version of my knife sub weapon. It was practically a cake walk. No problems…
I was/am really excited about my basic AI enemy. I made a
cool mechanic out of the player’s teleport window blocks enemy projectiles.
The white rectangle is actually two enemy’s stacked on top
of each other. The pink lines are attack projectiles.
Then Thursday happened. Because everything went so well on Wednesday
I thought we can make another enemy in a day. This time I wanted a spot light
enemy that visually ‘patrolled ‘ a piece of ground by looking back and forth
between two points then if the player was occupying the space the spotlight was
looking at stop and fire at the player. I couldn’t get the projectile to head
toward the player. It would instead spawn in with the desired rotation and head
screen left. I then spent too much time fighting trying to get the thing to
work and none of it working. I would have been better off playing more Rimworld
that is how much Thrusday’s work accomplished.
Because my new AI wasn’t working out I then decided to make
my Player into a prefab something that I had been putting off but it was about
time to do. That BROKE my teleport artwork. I then spent the next hour fixing all of the things that this broke. I was expecting some breakage but I wasn't expecting HOW broken this would get. Basically Thursday’s progress was
all in the opposite direction. I could never get the hang of Thursdays.
No comments:
Post a Comment