This sounds a bit boring, but trust me - I'm in the biz!
The secret is planning.
Get the game-flow clear in your head before you even start coding. Even better, get it down on paper. (OK, so there are some exceptions! - You may want to build a "testbed" to experiment with the game-engine.)
In the industry, a lot of people get wrapped up in 5 squillion page design-docs, but all you need is a clear idea about exactly what the player has to do, and what happens when they interact with the UI (User Interface) and the game itself.
Get a few mates over, order a pizza, and "bounce some ideas around". But at the end of the day, what you really need is focus. Know what you want. If you're unlucky, your vision may not produce a great game, but a "design by comittee" will almost certainly be a poor one.
Keep at it!
LotBC