I want to learn the best way to implement this:

I have a hero and an enemy on the screen. Say the hero presses "k" to get out a knife, I want the enemy to react in a certain way.

Now, if in my game loop I have a listener for the key press event and I identify a "k" was pressed, the quick and easy way would be to do:

```
// If K pressed
// hero.getOoutKnife()
// enemy.getAngry()

```

But what is commonly done in more complex games, where say I have 10 types of character on screen and they all need to react in a unique way when the letter "k" is pressed?

I can think of a bunch of hacky ways to do this, but would love to know how it should be done properly.

I am using C++, but I'm not looking for a code implementation, just some ideas on how it should be done the right way.