public void Init(Player player) { this.mPosition = player.getPos; this.mVelocity = player.mVelocity; this.mOrientation = player.mOrientation; this.maxSpeed = 14; }
public void seek(Player target) { //With Arrive mVelocity = target.mTranslation - mTranslation; // if near player slow down if (mVelocity.Length() < 200) { mVelocity = mVelocity / 4; // 4 = timeToTarget } if (mVelocity.Length() > maxSpeed) { mVelocity = Vector2.Normalize(mVelocity); mVelocity = mVelocity * maxSpeed; mOrientation = mVelocity; } }