# Opposite angle

### » Sat Jul 16, 2011 9:52 am

Hi guys,
I need help with an opposite angle. It is necessary that at collision the bullet and the wall, the bullet went to the opposite angle.How to do this? Thanks!
B
2
G
1
Posts: 10
Reputation: 470

### » Sat Jul 16, 2011 11:37 am

Try this:

+ Sprite: On collision between Sprite and Box
-> Sprite: Set angle to 180-Sprite.Angle+2*Box.Angle

Just make sure to set the angle of the walls (Box) accordingly. The Left wall should have a angle of 0, Top wall 90,... etc.
B
82
S
26
G
63
Posts: 4,842
Reputation: 45,724

### » Sat Jul 16, 2011 11:46 am

Hi R0J0hound , thank you for this valuable information.

I Just wonder what if walls didn't place like a square box. What if collision object was an ellipse ? Than how can I give angle to it ?
B
7
S
1
G
1
Posts: 76
Reputation: 904

### » Sat Jul 16, 2011 12:16 pm

[QUOTE=R0J0hound] Try this:

+ Sprite: On collision between Sprite and Box
-> Sprite: Set angle to 180-Sprite.Angle+2*Box.Angle

Just make sure to set the angle of the walls (Box) accordingly. The Left wall should have a angle of 0, Top wall 90,... etc.[/QUOTE]

R0J0hound thanks, it works perfectly.
B
2
G
1
Posts: 10
Reputation: 470

### » Sat Jul 16, 2011 12:25 pm

You could also try using the Ball movement instead, which has actions to bounce off any angle surface.
Scirra Founder
B
363
S
216
G
75
Posts: 23,122
Reputation: 180,543

### » Sat Jul 16, 2011 3:50 pm

maybe this can help-
http://dl.dropbox.com/u/5811650/bulletBounce.cap

It uses the custom behavior and can work for any surface.
B
9
S
3
G
3
Posts: 366
Reputation: 2,301