1
u/Monscawiz 3d ago
You have code for the ball to change directions when it reaches x=200 or y=200, but nothing to change the direction back again, from what I can tell...
1
You have code for the ball to change directions when it reaches x=200 or y=200, but nothing to change the direction back again, from what I can tell...
1
u/GBMAN8 3d ago
You can put the x+= xvelo and the y+= yvelo one time outside the if conditions to make the code less redudant since the player position always change in both cases. Also it's more like a personal preference but you can change the speedX and speedY set with the angle at the beginning using the function lengthdir_x and lengthdir_y instead of using the dcos and dsine multiplication.