public void Update() { if (!start && rectangle.X < Mygame.camera.cameraPositionX + 800) { velocity = new Vector2(-1.5f, 0); start = true; } if (ifDead) { DeadTimer--; } if (DeadTimer == 0) { Sprite = new EmptyScreen(Mygame.items); rectangle = new Rectangle(); } if (start && MoveTimer > 0) { MoveTimer--; } else if (start && MoveTimer <= 0) { this.ChangeDirection(); MoveTimer = 400; } Sprite.Update(); velocity += acceleration; rectangle = new Rectangle(rectangle.X + (int)velocity.X, rectangle.Y + (int)velocity.Y, rectangle.Width, rectangle.Height); }
public void TakeDamage() { health -= 2; if (health <= 0) { ifDead = true; Sprite = new EmptyScreen(Mygame.items); rectangle = new Rectangle(); } }