Bullets direction based on player's angle

Get help using Construct 2

Post » Mon Apr 02, 2012 2:31 am

I making some tests. Making a top view shooter (picture the bird's eye view stages on Contra), but I have a problem, I want the bullets to go in the direction the player is pointing its gun.

I managed to make them change their angle so they move in the desired direction, but if I move the player (rotation) then all the bullets on screen change their angle as well.

Is there a way to make the bullet angle change only when it first spawns or at least treat all bullets as separate instances instead of a whole?
B
6
Posts: 13
Reputation: 477

Post » Mon Apr 02, 2012 5:34 am

It seems u having problem to select only the the bullet it going to spawn.
can u show me the event you did to make it change it's angle?
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

Post » Mon Apr 02, 2012 6:11 am

Right now it is kind of working although not that elegant of a fix. It looks like this (the object now has custom movement behavior)

Bullet|Visible -> Accelerate X to Player.Angle...

Its seems that because of the delay that acceleration causes in the object's movement it has no time to change angle when the player does.
              
B
6
Posts: 13
Reputation: 477

Post » Mon Apr 02, 2012 1:41 pm

Try using

"Trigger once" and "for each"

For each Bullet trigger once set to angle

This should do it
B
28
S
2
Posts: 69
Reputation: 1,491

Post » Mon Apr 02, 2012 2:59 pm

After the action "Create bullet", "Set angle" to bullet and it will automaticly pick (and only pick) the newly created bullet, without needing any other filter.
You also don't need "Trigger once" or "For each".

In doubt, post your capx and be sure to check the examples already listed in the how do I FAQ, shooting has been covered more than once.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Tue Apr 03, 2012 6:38 am

Saw one of the examples, the one with lasers and it made the trick, thx man. I have to read the examples more thoroughly
B
6
Posts: 13
Reputation: 477


Return to How do I....?

Who is online

Users browsing this forum: DemantDigitalArt, Lancifer and 27 guests