How do I do the enemy AI

Get help using Construct 2

Post » Mon Feb 02, 2015 12:00 pm

I am making an 2d action runner game with guns. There are some flying enemies. I need to make enemy To shoot the player. can someone help me or link me to a video ?
B
3
Posts: 1
Reputation: 177

Post » Mon Feb 02, 2015 9:43 pm

How about creating a bullet object and add the "bullet behaviour" to it, then make the ennemy spawn that bullet object (using the sprite's "spawn another object" action) and change the angle of the "bullet behaviour" to make it move towards you player (by calculating this angle using the "angle" math System expression) ?

Bullet behaviour : https://www.scirra.com/manual/90/bullet
System expressions : https://www.scirra.com/manual/126/system-expressions
B
11
S
3
G
3
Posts: 206
Reputation: 2,379

Post » Mon Feb 02, 2015 10:00 pm

You can Pretty much use the same approach as the tower defence example, these towers track the enemy ( Using turret behaviour ) and then spawn a projectile object like @Kan stated, that can track and even pre-empt the players next location (depending how difficult you want it to be). If you go to new project scroll down the list and look for the tower defence example and de-construct the code they use. After you get that working its a simple task of making that sprite move in the air, there are a number of tutorials for moving enemies right here at the top of the page under the tutorials heading. Hope this helps.

Regards
Joel
B
7
S
1
Posts: 61
Reputation: 567


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 29 guests