Well done then, I though that levels are randomly generated. Is it always the same level? It's very difficult to make whole game really random (too much code) BUT there is a simpler solution. You can try create a level chunks, for example 10x10 with possible entrance points in the middle (left, top, right, bottom). Then if you have lets say 20 different templates, you can randomly arrange them as a mosaic. Then you just need an algorithm to check that randomly generated map has a solution. If it does not have, then create a new one. It's not a proper solution but it will quire less time than proper random level generation.
Taking in an account that this is your first game, I would say good job! As for the enemy jumping in/out of the edge, you can check this short but useful video https://www.youtube.com/watch?v=XQ_w9iZl0UM