How do I Make AI Shoot in direction of player

Get help using Construct 2

Post » Wed May 20, 2015 12:36 pm

I am currently making a game that is a naval game. I have the AI moving around the layout and need it to fire when it has line of sight of the enemy. Currently my issue is that the AI fires only when the player is directly to the right of it. I have the turret behavior being used with rotation off. If I turn rotation on the ship rotates toawrds the player then shoots. I need the ship no to rotate but shoot in any direction. Please help. :D
B
3
Posts: 11
Reputation: 199

Post » Wed May 20, 2015 1:12 pm

Why do you have the turret set to rotation off if you want the turret to rotate?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri May 22, 2015 11:48 am

Because otherwise the whole image rotates
B
3
Posts: 11
Reputation: 199

Post » Fri May 22, 2015 11:53 am

Would giving the turret behaviour to an invisible sprite pinned to the ship solve your problem?

Another solution would be to get rid of the turret-behaviour altogether and just spawn the bullet and set it's angle..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri May 22, 2015 12:24 pm

Ill Pm you the link as i cannot post it. If you can get it to work or have ideas that would be great. I have tried the invisible object and it wouldnt move. it would just shoot in the same direction.
Last edited by brendanschaffric on Fri May 22, 2015 12:25 pm, edited 1 time in total.
B
3
Posts: 11
Reputation: 199

Post » Fri May 22, 2015 12:26 pm

https ://www.drop box. com/s/kathqdvk9fxcxpz/Naval%20Warfare.capx?dl=0
B
3
Posts: 11
Reputation: 199

Post » Fri May 22, 2015 1:34 pm

After removing a lot of unnescessary events/conditions/actions:

https://dl.dropboxusercontent.com/u/485 ... nfire.capx
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri May 22, 2015 1:52 pm

brendanschaffric you will find your answer file call Direction shoot.capx

https://www.dropbox.com/sh/eioscti86bpr ... 7YPza?dl=0
B
251
S
39
G
15
Posts: 1,964
Reputation: 40,721

Post » Wed May 27, 2015 12:06 pm

Okay thank you. I added more ships for enemy's in the layout all being the same one and now they will not shoot. Anyway to fix it?
B
3
Posts: 11
Reputation: 199


Return to How do I....?

Who is online

Users browsing this forum: Bro7hers, brunopalermo, Calfuso, dop2000 and 21 guests