How do I enemy return fire...

Get help using Construct 2

Post » Thu Dec 18, 2014 9:56 pm

Can someone point me toward a tut on having the enenmy shoot at me when I'm close to him... the way I have it working he shoots 100000 bullets while I'm close to him
Need Sprites For Your Next Project?
100% Vector Animated Sprites
B
8
S
2
Posts: 170
Reputation: 1,086

Post » Thu Dec 18, 2014 11:02 pm

The line-of-sight behavior is probably the best way to go.

https://www.scirra.com/manual/163/line-of-sight

If you only have 1 enemy type, or if you are okay with all enemies having the same activation distance, you can put the LOS behavior on the player sprite, and look for enemies in view. This is much more efficient, as LOS can use a lot of resources if it's stuck on too many objects.

As for spawning bullets, place that as a subevent under the 'can player see enemy' event. You need two conditions:

For each enemy
Every X seconds (x being how often you want the bullets to be fired)
----Spawn bullet
----Set bullet angle toward player
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,187

Post » Fri Dec 19, 2014 2:57 pm

could do it like so
You do not have the required permissions to view the files attached to this post.
B
245
S
39
G
15
Posts: 1,946
Reputation: 40,276


Return to How do I....?

Who is online

Users browsing this forum: Darth Crusher and 1 guest