Simple ball game

I’ve made a very simple ball game (soccer / pool billard type of thing).
The coding is not exactly clean.

The difficult part is to make the ball move relative to the position of the camera when it is hit.
My workaround was to subtract the camera position from the ball position and use that value as the distance the ball is moving in the x- respectively y-direction.

To reduce that distance, I randomly divided it by 4.
This is what is not quite right in the script.

Can you think of another way of making the ball move in x- and y-direction?

Plus: The ball keeps going through the border walls, although I set its mass to 500 and also tried various combinations of bounciness and friction.
Do you know how to stop the ball from going through the walls?

Thank you!

Hi @mrcoblock, this is a good start! Have you tried pushing the ball, using the Physics CoBlocks available when Settings > Advanced is on?

1 Like