I am not a lawyer so this is not legal advice (you'd have to talk to a real lawyer for that), and the law varies around the world. But on the whole I think you are OK so long as you do not use any of the exact same assets (artwork, audio, etc.) or code, since that is all covered by copyright, nor the same name, since that may be a trademark.
Same here not a lawyer, but i looked intensively into copyrights over the years, and basically those are the CC rules (what Ashley mentioned), as long as you change the games look "reskin" don't use their assets, name and code structure(has to be different, you can use the same language, but not copy/paste anything that looks like the original ( and in some cases tetris don't use their layout size or object shapes - a lot of people got sued in court for this type of reasons, but this only happens, if the company wants to pursue your game/content and if its hurtful to them, in the tetris case, was a russian guy cloning it and calling it tetris something else... tetrisltd went in court they had a patent on tetris assets/game format/ how many pixels per row etc. i think they won the case, but then the court dismissed all claims similar to that cause tetris case created a precedent, and something wasn't right... tetris got in the end somewhere around 250k USD or so don't recall properly... it was early when they released the 1st game, and the guy that cloned it was hurting their income, releasing a exact copy with different shapes in the same time.)
in general you are safe to "inspire" yourself from other games or existing products, it's only natural otherwise innovation would basically stop, same as how Construct looks and runs similar to ClickFusion and GameMaker but doesn't mean is a clone of those engines, is just a competitor.
However, if the company that holds that product, has a patent on all the game aspects, you will be in a bit of trouble if you copy stuff that is visibly identifiable.
But if the product has no patent, and it was already released to public, they will never be able to patent it, all they can do is sue for "artists copyright" that covers, images, sounds and fonts and other design stuff. gameplay style is not protectable at this point.
Anyway, id double check this with a digital product and online distribution lawyer for official confirmation but this is what i know for stuff being "roughly legal/illegal" for the past ehm, been i think 8 years now...
Edited: sorry seen to late Skymans reply... we basically went over the same thing 3 times lmao
Edit 2: side note, worst case scenario? you get sued, all monetary gains you earned you have to give it to the guy that owns the rights for the artwork, gameplay etc... and you might be allowed to keep like 1% of future incomes if you play nice and beg for it :) otherwise, you lose the product. but in the end depends what is the original creator going to do as legal pursuing his rights... he going to allow you be in market or not.. if he allows it, you might get a copyright claim, and some % funds goes to him similar to youtube, or your game basically is taken down, but if you launch of ios ... ehm... i wouldn't do that, see apples platforms TOS... or even talk with one of their contacts... as google goes... anything goes there..
also forgot to mention .... nobody will pay you for your lost time, and court driving, and appointments to lawyers etc... so if it will go that far... you risking a lot of your time for something that isn't even worth it, cause if its a clone its probably gonna make like 50$ per 100,000 views, not even close to the prices lawyers ask per hour.