public override void Update(float time) { Position += Velocity * (float)time; if (RotateTowardsDirection) { Sprite.Rotation = Velocity.Angle(); } base.Update(time); }
public override void Update() { //Figure the difference between the position of the common zombie and that of the swarmflag float xDiff = Position.X - World.Director.SpecialFlag.X; float yDiff = Position.Y - World.Director.SpecialFlag.Y; //If the unit isn't near the swarmflag if (xDiff > 10 || xDiff < -10 || yDiff > 10 || yDiff < -10) { //Move the zombie to the users flag Velocity = ((World.Director.SpecialFlag - Position).ScaleTo(1.0f)) * SpeedMultiplier; //set position Position += Velocity; //Set the special flag FacingAngle = Velocity.Angle(); } }