of course you can it's more of just not using the x axis in your game which makes it easier. try using unreal because it allows you to code in c++. you can code any kind if game with c++ the kind of game you make is more reliant on the engine you use not the language.
You need a game engine to build a game.Obviously you will require the knowledge of a HLL(high lvl language) also.
You can try making simple games(very simple games) but if you want to create somthing with game options(GUI), you'll require a game engine for that purpose.
you can make almost anything with C++ as far as you have the time to put some code on it. Always consider what other have done that is available to use in your project. For 2D games there are some libraries that take care of the basic stuff so you can focus on make an original game... but if you are not happy with the engine libraries that are out there you can still make you own 2D engine library.