Those things are really easy to say, but as someone who's gone from being pretty good at what they did to being shit at what they do, sometimes it's
really effin hard to "just focus".
When I'm faced with a hard problem at work, my immediate reaction to not wanting to fail miserably is to open a random website and just browse. So I basically installed a website blocker. It's easy to disable, but it does require you to explicitly go to Chrome extensions and disable it, and that turns out to be just enough to make you think twice. It eliminates the knee-jerk reaction to being faced with a hard task. Now I allow myself a little bit of browsing in the morning, just after lunch and after a hard session of work.
It also helps if you keep working and playing environments separate. Your brain unconsciously associates areas with certain types of activities. For example, bed is for sleeping, school is mostly for working and/or falling asleep, etc. If there's an environment where you don't play at, you can make that into a work environment. I try really hard not to work at home, because then work would consume my entire life, but it has the unfortunate side effect of me not being able to work at home anymore. But if I really need to, I'll take whatever I need to do and go to a different table in the house, which is no longer my play area. The brain isn't immediately "oooh, play area! Let's play!", so you can force yourself to work there more easily.
There are little tricks that help, but ultimately it's going to be up to you. Whether you decide to stay at school longer to work on things and then get home and play all the games without conscience problems or whether you find a space at home, you'll still need to force yourself to work on things.
Eventually getting over that hurdle that stresses you out and becoming good at things, as I like to say, becomes its own reward, and then things are easier and you feel better. I'm trying to get there myself too, though it's a hard, rocky road.
My tip is either set timetable for yourself (e.g. studying till 6PM, fun&games later) or develop a guilty conscience which will nag at you when you are not studying.
Ninja'd: if you're having a bad enough time on focusing, you'll just end up feeling guilty all the time, which won't really help you work. You'll just have trouble sleeping, have a constant sense of little self-worth and end up being miserable