Life's hard. There is so many distractions in the world, so many challenges and hardships we faced, and if you didn't yet, consider yourself lucky. It sounds sad and all but there's always a positive to a negative. You can use what you have and create something special.
The more I practice the luckier get - Gary Player
The more you code, the better you'll be. It's like riding a bike, you'll fall down a lot at first (I know I have), but by the age of 13 you'll probably be popping wheelies. If you code for 0 minutes a day, you will never learn how to code, but if you code for 30 minutes a day, maybe by a few month to a couple years you'll have a solid understanding of the programming language. Consistency is the key to unlock the doors to success. Fall in love with the process.
If you never fail, you'll never learn. That's a rule you should follow. 1 out of 4 of your ideas will fail, embrace it. It's something I learned to live by. Overthinking will solve nothing and it's okay to feel sad. That failure could be a stepping stone to success. Michael Jordan missed 9000 shots in his career, but he kept going. Don't look at it as failure, look at it as a learning point in your life. Failure is the ultimate teacher.
Games can be hard too. You probably have died more than one time in a video game. You also probably spent countless hours on grinding too. Think of life as a game. You start off as a random person in a random place in life, and you discover new habits. Maybe you look up to Stephen King and want to be a best selling author. To do that your going to have to grind. You'll start off as a level one writer and face unsuccessful attempts but the more you write, the better you'll get, like I said, consistency is key. Let's say your out of shape and you want to jog a mile, if you start off jogging your stamina would be really low. If you jog more and more your stamina will increase, and you'll be able to reach your target. The rules to the game are easy, the more you do something, the easier it becomes. Same applies to socializing, the more people you'll meet out in the world, the more social you'll end up becoming. Ways you can gamify your learning in how to code is using the Pomodoro technique or flow. Flow is a way to see how long can you focus without getting distracted.
There are rules the game, your playing in survival mode, so you'll have to eat, drink, and sleep. Try not to work more than two hours at a time. Also know, time is limited, so work on your highest priority first.
These are some of my tricks that kept me motivated. One thing that helps me a lot, is results. If you grind it out and finally completed a project, it just gives you a great feeling that you accomplish something. Just keeps focusing on your goals, and you'll get there. Happy hacking.