When there is not a collision you have put that if dudeY is less than 390 (The Ground ) and jumpheight = 10. Then to activate a jump " canjump = 1 and jump = 1" but instead of making him jump upwards hes actually jumping towards the ground. Hes jumping towards the ground because jumpheight has been changed to negative number.
Yes, he jumps down. It is a quick hack. You might want to create some custom code for falling down.