To tie a puzzle into your story can be done in many ways. You can have it a new scene that you move to, or part of the scene or part of an overlay, etc, etc, etc.
The best thing would be to try to code what you want to do and then post if you have a problem. You really have to lay out on paper or in your mind what you want to do and then try to code it. I spent many, many hours solving the problems of coding a puzzle but it helped me a lot to figure it out on my own. If you can't figure it out on your own, it's nice to know you can ask questions here and someone will hop in. But you have to give the hoppers-in a break and try yourself first. : 0 Only you know your game and how a puzzle would tie in and where you would have to place globals to do certain things. You might not even understand an explanation unless you try it first yourself.