Moving Enemy

Today, I wanted to make the enemy move as It seemed rather dull due to the lack of movement in my game. So I added a waypoints script. After I done this all I needed to do was set the points of which I wanted my enemy to move. I have made my enemy move backwards and forwards in a path. This is the first enemy, I intend to add a few more to add more off a challenge to the game.

Enemy attacking player.gif

At first the enemy moved backwards and forwards without any rotation at all. This was bad so I added a trigonometry script to make the enemy track the player. After I was content with the movement I then added an auto firing script. (Yes there is room for improvement, I want to add a vision script so he does not look at my player through the walls) There was also an issue with this as the bullets went though the walls which was not good. this lead me to adding a box collider and increasing the power so the bullet disappear on impact as it now collides with the wall.

bad enemy movement.gif

This is what the enemy movement was like when it was broken before I added the trigonometry scripts.

Due to the fact the bullet and the enemy has a collider they collide with each other. I made a new layer and called it enemy, I called this enemy. I then went into edit/project settings/2D Physics. This allowed me to edit the physics. I went to the ‘Layer collision matrix’ and went to the enemy layer. and un ticked this box so they no longer collide leading to smoother bullet firing.

matrix.PNG

For the enemy I just loaded my character into PS, then I copied it and changed the hue to make it red. This was because I wanted a variation between the character and enemy. I made him red because red is often associated with a baddie/ enemy.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s