Do you honestly expect that someone will read your code without proper syntax highlighting and formatting?
Here is how you can use code tags (you can edit your message):
Also, the fact that you are using 2D for something, doesn’t mean you should post your question to 2D forum, this sounds more like game logic related question. Scripting forum has way more people reading this kind of questions.