cleaned code a bit and changed player attack function