public override void Update(float delta) { if (Alive) { KeyboardState keyboardState = Keyboard.GetState(); bool left = keyboardState.IsKeyDown(Key.Left); bool right = keyboardState.IsKeyDown(Key.Right); bool up = keyboardState.IsKeyDown(Key.Up); bool down = keyboardState.IsKeyDown(Key.Down); bool shift = keyboardState.IsKeyDown(Key.LShift); Vector2 movement = new Vector2(); if (left ^ right) { movement.X += left ? -1 : 1; } if (up ^ down) { movement.Y += up ? -1 : 1; } bool running = false; if (shift && !regeneratingStamina) { if (running = (Stamina > 0)) { Stamina -= delta; } } else { Stamina += delta * (Moving ? 0.5f : 1); } Move(movement.NormalizedSafe() * delta * SPEED * (running ? 2 : 1)); if (Moving) { animation.Update(delta); if (running) { animation.Update(delta); } } else { animation.Reset(); } foreach (var entity in Map.Entities) { NPC npc = entity as NPC; if (npc != null && npc.Alive && npc.CollisionBox.IntersectsWith(CollisionBox)) { npc.HP = 0; bloodEmitter.Position = npc.Position; bloodEmitter.Emit(25); } } } }