Hi there, i am trying to create a enemy who spawns and move towards y position with my knowledge i got this.I can move the object on Y position, but cant make it increase speed over time.
private Rigidbody2D rb2d;
public float speedIncrement = 10f;
public float maximumSpeed = 70f;
public float speed = 2;
public float scroolSpeed1 = 2;
void Start()
{
////Get and store a reference to the Rigidbody2D attached to this GameObject.
rb2d = GetComponent<Rigidbody2D>();
////Start the object moving.
rb2d.velocity = new Vector2(0, 1) * scroolSpeed1;
}
void FixedUpdate()
{
scroolSpeed1 += speedIncrement;
if (scroolSpeed1 <= maximumSpeed) scroolSpeed1 = maximumSpeed;
}