How do I mirror/invert/reverse a bullet direction on click?

Get help using Construct 2

Post » Mon Mar 24, 2014 7:46 pm

Basically, can I trigger/fire a bullet object at the exact opposite direction of my mouse click / touch point?

What I'm trying to achieve is fire bullet A from the player character at the angle of where the mouse click as well as fire bullet B to the opposite side of the mouse click. If I click in the top right corner of the screen, bullet A will fly towards that point. Then at the same time bullet B will fly towards the opposite direction at the lower left corner of the screen.

My code for the bullet A control is 2 lines of code:
Touch: Is in touch:: Player: Spawn bulletA on layer 0 (image point 0) :: bulletA : Set angle toward (Touch.X, Touch.Y)


I can't figure out properly the code for the bullet B movement. Any help is appreciated, thanks.
yupenglee.com | @JustOnlyYu
B
14
S
3
Posts: 16
Reputation: 872

Post » Mon Mar 24, 2014 8:18 pm

You could do something like this:

https://dl.dropboxusercontent.com/u/2560922/mobiledev/forum/twoBulletsInOppersiteDirections.capx

just spawn a bullet the same way you spawn bullet A and then reverse the angle
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Mon Mar 24, 2014 8:46 pm

@cvp Goddamn it was something simple like that. I was going about it at a different, more complex way. Thanks!
yupenglee.com | @JustOnlyYu
B
14
S
3
Posts: 16
Reputation: 872


Return to How do I....?

Who is online

Users browsing this forum: draiza, Google [Bot], mindragon73 and 6 guests