Problems with Simple Enemy AI in a shooter game

0 favourites
  • 5 posts
From the Asset Store
Give Sound to the enemies that are part of your game! :)
  • Hi guys, I'm working on a 2d shooter game similar to Contra. However i have a problem with the enemy that i want to insert (sprite Helmet). I want that when the enemy sees the player he runs toward him shooting. When the enemy reaches him he goes through him and, after a little run in the same direction, he turns again towards the player and he restart the run.I tried to do this with a function (that is in the group HELMET of the event sheet). It makes sense in my opinion but the enemy always stop the run when he touches the player. I have also other problems: the enemy shoots in all directions, instead i want that him can shoot only horizontal(i don't know how to do).Besides for no reason the bullet i shoot bounce when i shoot in direction of the enemy. It does that only whit the function of Helmet. I attach the Capx and i Hope someone could help me :).

  • With the bullet just add this and delete the action underneath when you spawn the bullet

  • use DISTANCE(X1,Y1,X2,Y2) or LINE OF SIGHT

  • took the liberty to change it for you and also commented it

    download Definitive_game-Copia-updated-01. capx

    i didn't fixed the bullet of player problem, just the enemy, for the bullet of enemy u have to separate the angle of motion set... on 3 distinctive condition layered as bellow

    Main>>>bullet on created

    sub 1 >>>> character is mirrored set bullet angle to 180

    sub 2 >>>> character is not mirrored set bullet angle to 0

    sub 3 >>>> if W is pressed set bullet angle to 270

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I solved the problem with the code of sizcoz but thanks to all of you guys,very appreciated! :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)