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! <img src="smileys/smiley17.gif" border="0" align="middle" />
<img src="http://screenshot.su/img/b9/3b/d4/b93bd4fa8259d859783b11ff191a31a8.jpg" border="0" />
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.
Develop games in your browser. Powerful, performant & highly capable.
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 ?
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.
R0J0hound thanks, it works perfectly. <img src="smileys/smiley32.gif" border="0" align="middle" />
You could also try using the Ball movement instead, which has actions to bounce off any angle surface.
maybe this can help-
http://dl.dropbox.com/u/5811650/bulletBounce.cap
It uses the custom behavior and can work for any surface.