Problems with enemy bullets

Get help using Construct 2

Post » Mon Mar 30, 2015 11:50 am

I keep having problems with my walking and shooting enemies.

I have set them when they see the player they fire with an instance variable that sets the direction of the bullet. Unfortunately the other enemies that don't see the player keep moving and when they change direction it sets the direction of the bullets to the other way.

It's probably simple fix but it's driving me mad.

Cheers
B
5
S
1
Posts: 37
Reputation: 449

Post » Mon Mar 30, 2015 12:21 pm

I think I understand what you mean... Give the bullets their own instance direction variable, update it with the direction when fired and they will act autonomous.

Unless you mean it sets the enemy instances firing direction the other way... in which case you would need to condition out enemies in LOS of of player by adding a condition to the direction change event that only allows non-sighting enemies to advance to actions.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
68
S
17
G
8
Posts: 637
Reputation: 9,420

Post » Mon Mar 30, 2015 12:46 pm

I think that second method may work. Basically when it see's the player it with fire straight at him but if another enemy is still walking and hits the change direction sprite it will change the direction of the bullet.

I didn't get why it did it because the bullets and enemies all had instance variables to set directions.
B
5
S
1
Posts: 37
Reputation: 449

Post » Mon Mar 30, 2015 8:22 pm

Its doing it because they are all clones (instances) of the original and you need to separate out the instances you want to be affected by an event otherwise Construct2 simply tells them all to act. Read Ashley's advanced events tutorial and focus on "Picking": https://www.scirra.com/tutorials/292/guide-to-construct-2s-advanced-event-features. It will help get your head around it some.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
68
S
17
G
8
Posts: 637
Reputation: 9,420

Post » Tue Mar 31, 2015 9:52 am

Thanks now I'm trying to make each each sprite shot in its own independent direction depending on the UID.

I really didn't think I would find it so damn hard.
B
5
S
1
Posts: 37
Reputation: 449

Post » Tue Mar 31, 2015 11:44 am

Solved it now and it was so simple thanks for the help
B
5
S
1
Posts: 37
Reputation: 449


Return to How do I....?

Who is online

Users browsing this forum: richardfu and 42 guests