My game
woila =
is like this. A 2D shooter where you control the cowboy on the left hand side and you fight against the bot/ai
As of right now he can shot and that’s good but i need him to be able to move up and down on it’s own.
If i could somehow make him be able to move up and down while like following my side while he’s shooting. But not so that he’s exactly like my controls…
I have this script for him already
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Enemy generic behavior
/// </summary>
public class EnemyScript : MonoBehaviour
{
private WeaponScript[] weapons;
void Awake()
{
// Retrieve the weapon only once
weapons = GetComponentsInChildren<WeaponScript>();
}
void Update()
{
foreach (WeaponScript weapon in weapons)
{
// Auto-fire
if (weapon != null && weapon.CanAttack)
{
weapon.Attack(true);
SoundEffectsHelper.Instance.MakeEnemyShotSound();
}
}
}
}
As you can see. He’s only been scripted to shoot…
I don’t know how to make him go up and down by himself.
His location is like this y -3 at the buttom
And at the top it’s 3
So
If i could make him go up and down between those 2 locations it would be perfect…
So here comes the big question. Can you help me? please this is the last thing i need.
Sincerely - Tereith -