Skip to content

Commit

Permalink
enemy movement
Browse files Browse the repository at this point in the history
walks towards you - I need to make it so the turning is like the player looking.
  • Loading branch information
theradest1 committed Mar 11, 2022
1 parent e5f3f84 commit 134e190
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Assets/Scenes/Main.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 705507994}
m_IndirectSpecularColor: {r: 0.44657844, g: 0.49641222, b: 0.57481694, a: 1}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -441,6 +441,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
Player: {fileID: 330849826}
speed: 0.5
--- !u!114 &62509514
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
2 changes: 2 additions & 0 deletions Assets/Scripts/EnemyMovement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public class EnemyMovement : MonoBehaviour
{

public GameObject Player;
public float speed;

// Start is called before the first frame update
void Start()
Expand All @@ -17,5 +18,6 @@ void Start()
void Update()
{
this.gameObject.transform.LookAt(new Vector3(Player.transform.position.x, this.transform.position.y, Player.transform.position.z));
this.gameObject.transform.position += this.gameObject.transform.forward * speed * Time.deltaTime;
}
}

0 comments on commit 134e190

Please sign in to comment.