Opposite angle

For questions about using Classic.

Post » 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!
login1k2011-07-16 09:53:14
B
2
G
1
Posts: 10
Reputation: 470

Post » 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
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » 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

Post » 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

Post » 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
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » 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


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest