eh, OMG!
It's very hard to tell exactly what your trying to do here, This is going to sound harsh, but I think you need to start this one over and plan out exactly what you need it to do.
Here are some of the problems for you to look at...
I don't see why you need that "while hits>0" loop, it has little purpose, except it loops 30 times if no collision was detected.
this is the same as writing
Practice make perfect :)
It's very hard to tell exactly what your trying to do here, This is going to sound harsh, but I think you need to start this one over and plan out exactly what you need it to do.
Here are some of the problems for you to look at...
I don't see why you need that "while hits>0" loop, it has little purpose, except it loops 30 times if no collision was detected.
dirx = -dirx
this is the same as writing
dirx = 0 - dirx ; (results as -5)and when you call it again it will result as 5 again, is this what you intended?
pbs\x = player\x pbs\y = player\y pbs\x = pbs\x + dirx pbs\y = pbs\y + diryis the same as writing
pbs\x = player\x + dirx pbs\y = player\y + diry
Practice make perfect :)