Commit cdc94e37 authored by Cody A Burchett's avatar Cody A Burchett

-m

parent d35289a0
...@@ -3,9 +3,15 @@ using System.Collections; ...@@ -3,9 +3,15 @@ using System.Collections;
public class FlameCrab : MonoBehaviour { public class FlameCrab : MonoBehaviour {
//update once grid is ready
//array of positions to move to once grid is ready
//Vector3 [] positions;
public float moveDelay = 5f; public float moveDelay = 5f;
public float speed = 5f; public float speed = 5f;
public float health = 10f; public float health = 10f;
public int moveDistance = 5;
float nextMove = 0f; float nextMove = 0f;
Vector3 targetLocation = -Vector3.up; Vector3 targetLocation = -Vector3.up;
...@@ -22,7 +28,7 @@ public class FlameCrab : MonoBehaviour { ...@@ -22,7 +28,7 @@ public class FlameCrab : MonoBehaviour {
{ {
if (targetLocation != -Vector3.up) if (targetLocation != -Vector3.up)
{ {
if ((transform.position - targetLocation).sqrMagnitude > .15f) if ((transform.position - targetLocation).sqrMagnitude > .5f)
{ {
Move(); Move();
} }
...@@ -35,7 +41,7 @@ public class FlameCrab : MonoBehaviour { ...@@ -35,7 +41,7 @@ public class FlameCrab : MonoBehaviour {
else else
{ {
//find new target location to right or left of enemy //find new target location to right or left of enemy
int spacesToMove = Random.Range(-5, 6); int spacesToMove = Random.Range(-moveDistance, moveDistance+1);
RaycastHit2D hit = Physics2D.Raycast(transform.position, transform.right, spacesToMove, 1); RaycastHit2D hit = Physics2D.Raycast(transform.position, transform.right, spacesToMove, 1);
if (hit.collider) if (hit.collider)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment