Ok, two problems.
First is you are checking the angle of the maskplayer in events 2 and 3. It doesn't have angles.
Solutions - You could check the angle of the sprite 'Sprite', or you could check the maskplayer private variable 'dir', I would recomend the latter.
Second is you are subtracting the detector width in event 4 when you need to be adding it. maskplayer:set x to edge.x "+" edge.width