When we are in tune with ourselves, when we know that an action is truly the most important at the moment, when we truly feel its importance to our core, when we realize other alternatives are not what we truly desire, we attempt to do/move towards doing that action.
When you are studying, if it is not your heart’s desire at the moment, if it is not the action that you would want to do while in tune with yourself, you will be distracted. You say you want to study, but why would you be distracted with thoughts of gaming then? There must be a reason for this.
You must discover this reason yourself to truly understand it and with this understanding you will be able to let go of the pattern.
For studying, gaming, or any activity that we desire to do, we desire happiness, self expression and growth. As long as we are able to be truly fulfilled while doing an activity, we will progress in life. We will grow, we will be expressing ourselves, we will be happy. And this growth, self expression, happiness will be a service to others as well. A person who is progressing this way is both an inspiration and support to others in various forms. People will be supported by your energy; in mental, emotional or physical aspects.
So, if you can learn to be fulfilled while doing any activity, you will do that activity fully, your mind will not need to search for other sources of fulfillment. This is possible when you learn to be fully present, fully aware, feeling Love within yourself as best as you can while living your life. The more we embody this state, the more distractions in the mind will quiet down, the more peaceful the mind will be.
The thoughts of gaming can not be forcefully removed. Fighting against them directly with force, at most you can suppress them but then later they will return more strongly.
Practice living your life as awareness, practice being in tune with your heart. This will teach you to embody the state of fulfillment I have mentioned. As you practice, there will be a progress towards this state where you will still experience the distracting thoughts in the mind but they will gradually lose their power.
Awareness is our true self. We are the awareness where the experience of life arises in. Within this awareness, life arises from the depths. Unconditional love, the life force energy flows into the human being from the spiritual heart. By staying as awareness and focusing on this life force energy as best as we can, we learn to be fulfilled in the present moment. Then, we can freely flow while doing any activity we desire, because there won’t be the need to go seek fulfillment elsewhere, there won’t be the need of distractions, thoughts that say fulfillment is somewhere else, not here.
Notice that the more you lose your presence, the more the thoughts of seeking, thoughts of distractions will increase in your mind. You can gradually better understand this trend by being aware in the present moment throughout the day and then becoming aware that you lost this presence and got identified with the thoughts in your mind.
In a certain level of consciousness, studying and gaming have similar characteristics. We aim for happiness through these activities. By studying we prepare for something that signifies happiness in the future, by gaming we chase after a sense of happiness by trying to achieve the goal of the game.
In a more awakened state of consciousness, study and gaming get closer, we can feel like playing when we study, or we can feel like studying while gaming. Because with presence, happiness is there while studying, and growth is there while gaming. We are expressing ourselves through these activities and we are fulfilled. From this perspective one is not superior to another, they are just experiences of different form. But the experiencer is always the same.
In this state of consciousness, we will be creating from ourselves, not getting our happiness/self worth from the game or studying or our job,place or acceptance in the society. We will be realizing ourselves as the source of happiness, that happiness flows from within ourselves into the world. Therefore with this realization evolving within us, we will be becoming free from the activity itself, from our dependence on the activity for our happiness. So the thoughts of gaming as a distraction will cease, the thoughts of study as a reluctant obligation will cease.
The essence of my answer is know your self in the present moment as fully as you can while doing anything. This is more effective than fighting inside your mind, struggling with yourself. Transcend your mind by learning to live as (giving yourself the experience of living as) your true self. This way your question will be resolved.
Update: I decided to add this article to the answer. By practicing meditation as explained in this article, you will be utilizing an effective process that teaches to stay in presence. If you practice, it will effectively evolve your understanding on what I truly mean in this answer.