What is wrong with this piece of.... code

Hi there!
I am having some problems with my code no idea if it is logical or what is it. For some reason, when i move or access the buttons on a vertical motion, gives me the wrong coordinates. While with horizontal movement its ok.
I cracked my head and i could find why. :sen:
Trying to do a BattleShip game.

HELP!

The file is attached. Download it, and c what i am talking about.
Cheers!
Leo.