As already the existing people have added good answers, let me answer uncovered situations.
If at all you are in a position where you have completed coding your game and now starting to code achievements and find it very complex to maintain too many variables and counts and clearing them off at certain events and things like that.
You can always create one class (preferably singleton) to receive all events. Now list all your achievements. Then list all game events needed to be tracked. For e.g. my current list looks like this
KILL ENEMY - walking, bullets
PLAYER DEATH - falling_off, health
ENTER_ROOM, EXIT_ROOM etc.
Those extra details like walking, bullets can be parameters. Now have one function called fireEvent in that Achievement tracking class. Search all places in code where you need to fireEvents and call that function. Now do the rest of dirty work in the Achievements class. this is the safest way to not disturb existing code and code Achievements. It worked out pretty fast for me.