### How to: Bounce ball depending on the paddle´s position

#### sex92toso

• Posts: 12
I have a paddle and a ball actors. i want to the ball to bounce to a different direction depending on the paddle´s position. I am new so I would prefer if you explain in to me step by step. Thanks(:

#### Sunflower

• Posts: 591
Alright, so at the beginning you need to add an Actor behavior, which will be later attached to balls.

After that, you need to make a check whether ball collided with paddle. And I have completely no experience regarding collisions, since I'm scared of them (I've been bitten by a collision when I was a little girl), but apart from that it's probably quite simple. ^^'

Then, once you find something checking whether ball collides with paddle, then inside the check for collision with paddle you will to place there such block:

point [Self] towards [[-90] - [[ number ] x [ [x of [Paddle]] - [x of [Self]] ]]] degrees
where number modifies an angle a bit, depending on how much you want the angle to be altered by the position.

I think that it should do the trick when attached to ball. Of course, once you figure out how to check whether the ball has collided with paddle, first.

#### sex92toso

• Posts: 12
Alright, so at the beginning you need to add an Actor behavior, which will be later attached to balls.

After that, you need to make a check whether ball collided with paddle. And I have completely no experience regarding collisions, since I'm scared of them (I've been bitten by a collision when I was a little girl), but apart from that it's probably quite simple. ^^'

Then, once you find something checking whether ball collides with paddle, then inside the check for collision with paddle you will to place there such block:

point [Self] towards [[-90] - [[ number ] x [ [x of [Paddle]] - [x of [Self]] ]]] degrees
where number modifies an angle a bit, depending on how much you want the angle to be altered by the position.

I think that it should do the trick when attached to ball. Of course, once you figure out how to check whether the ball has collided with paddle, first.

:(I just tried what you said but it had no effect
I dont know why something that looks easy to configure is that hard S:
Thanks for the replay ^^

#### Alexin

• Posts: 3127
Shows us the behavior.

(By the way, quoting the post right above yours in its entirety is useless and only clutters the page.)
"Find the fun"
alexin@stencyl.com