I need help with boss design. I am new to coding so any help would be nice.
I need to have coffee be thrown at the player from the boss every 10 seconds. It needs to spawn at the boss, don't have the coordinates yet. Then it needs to expand on the ground into a puddle that does damage overtime to the player if they are standing in it. After ten seconds the coffee needs to despawn, so another one can spawn. It will be a loop until the boss dies. Any help at all would be greatly appreciated.
using UnityEngine;
using System.Collections;
public class CoffeeFinal : MonoBehaviour
{
private float nextActionTime = 0.0f;
public float period = 10f;
void Update()
{
if (Time.time > nextActionTime)
{
nextActionTime = Time.time + period; /* every 10 seconds the boss will throw the coffee*/
}
if (nextActionTime = period)
{
private Transform playerTransform;
void Start()
{
playerTransform = GameObject.Find("player").transform; /*so the boss can throw the coffee at the player*/
}
void update()
{
/*need to have the coffee be thrown, expand on the ground, cause damage if the player is standing in it, the after 10 seconds go away*/
}
}
I have changed the code. What i need it to do is spawn, move toward the players location, then expand into a puddle on the ground, do damage overtime if the player is standing in it, then despawn.
using UnityEngine; using System.Collections;
public class CoffeeFinal : $$anonymous$$onoBehaviour { void Start() { InvokeRepeating ("findingPlayer", 0.0f, 10.0f);}
void findingPlayer(){
GameObject playerPos = GameObject.Find ("Player");
Transform playerTransform = playerPos.transform;
// get player position
Vector3 position = playerTransform.position;
}
public Transform target;
public float speed;
void Update() {
float step = speed * Time.deltaTime;
transform.position = Vector3.$$anonymous$$oveTowards(transform.position, target.position, step);
}
}