public Enemy(Texture2D texture, Game1 game, SimplePath path) : base(texture, Vector2.Zero,new Vector2(texture.Width / 2, texture.Height / 2)) { this.pos = path.GetPos(path.endT); this.texture = texture; this.game = game; this.path = path; currentpos = path.beginT; followPath = path.GetPos(currentpos + 0.1f) - path.GetPos(currentpos); }
public void Update(double deltaTime, SimplePath path) { oldPosition = position; if (slowedTimer <= 0) { texPos += (float)(speed * deltaTime); color = originalColor; } else { texPos += (float)(speed * deltaTime) * slowedModifier; color = Color.CornflowerBlue; } slowedTimer -= deltaTime; position = path.GetPos(texPos); if (health <= 0) { UserInterface.gold += goldValue; isDead = true; } LookAt(position, oldPosition); base.Update(deltaTime); }