How do I Make a Enemy Target a player and shoot them

Get help using Construct 2

Post » Mon Mar 13, 2017 8:39 pm

So i'm currently make a game and i want the Enemy to target the play and to shoot them but its been confusing can some please help Thanks
B
3
Posts: 5
Reputation: 187

Post » Tue Mar 14, 2017 12:12 am

Just go to File -> New and look up the turret behavior tutorial.
B
52
S
24
G
18
Posts: 295
Reputation: 13,090

Post » Tue Mar 14, 2017 12:24 am

Need more info?

Is the enemy a moving enemy and is it a platform or RPG style game?
Banned User
B
28
S
7
G
58
Posts: 1,229
Reputation: 34,825

Post » Tue Mar 14, 2017 12:34 am

distance(enemy.x,enemy.y,player.x,player.y) < 200

enemy >rotate angle towards pos player.x,player.y - speed 10

subcondition every 1.2 seconds - create bullet at imagepoint 0 /set angle movement enemy.angle

=====================================
event condition separated for bullet or you can add it in action above on every 1.2 seconds when bullet is created automatically gets the angle.
=====================================
bullet on created set angle movement enemy.angle

=====================================
bullet actor must have bullet behavior on it.

you can add a event for bullet getting destroyed
=====================================

bullet traveled > 500 px

or

bullet on collission with player - action destroy.

=====================================
and a event for player life substraction you will need a localvariable or a number set on the player.
=====================================


player on collision with bullet substract "your value" from life

=====================================

thats the simple code. you will need to adapt that to C2 event system. but its mostly what the event language looks like.
B
78
S
23
G
69
Posts: 1,353
Reputation: 44,005


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 40 guests