After I died I respawned in the room with the key on sometimes different tiles, which seemed to determine whether I could get the key or not.
Viewing post in Adventuring Pixx jam comments
I can't seem to replicate it. That or I think the input is still going through from the previous level which makes the character move to the direction you were previously going before respawning.
Also, I didn't make it apparent in-game that you can "skip" or "pass" the turn by clicking space (because I forgot). Maybe that's the thing that is missing here?