It might be a problem with the velocity you could try and set it to 0 after a collision. I would also throw in somewhere where if you are colliding on the left you can't move left anymore. I Think that is problem you are talking about. When the x and y velocity are both set. Also you can probably use if/else if since if you hit the left you probably are not going to be able to hit the right.
It seems to be having a problem when it touches the corners of the square, what can we do for them? also If i go against it and then press another direction it screws up as well.
when it's not touching the wall anymore then you can enable it to move left again. Say you are trying to move right, if you are already hitting a wall on the right then you shouldn't be able to move to the right anymore right? So If you move left, up, or down and are no longer hitting the wall on the right side you can then move right again.
By the way I may need to bow out sorry :( Going to Vegas in a few hours for my brothers wedding and will be there all weekend. If you still need help when I get back I will help then but, until then someone else may be better suited to help.
Alright, I still didnt get it XD but i'm working on other stuff like putting things in separate files, do you think you could help me by telling me what i need to do to make it nicer and correct me?