Problem with Enemy AI in my Game

0 favourites
  • 6 posts
From the Asset Store
For problem solving, puzzles, bubbles, platforms and other adventures.
  • I have tried to create an enemy which stops and a throws a spear every x seconds at player 2 (the flying one) when player 2 is in a certain radius using the line of sight behaviour on the enemy and bullet behaviour on the spear however the enemy doesn't stop when the player is in its line of sight even though I have deactivated the group movement when the player is in the enemy's line of sight.

    Also, I am unsure on how to implement the spear mechanic as the sprite currently is pinned to the enemy but needs to be thrown and so unpinned in a semi-realistic fashion to how a person really throws a spear.

    I hope I explained my problem clearly and any help would be very appreciated.

    dropbox.com/s/bfjaauw1eyrynzq/Game%20%282%29.c3p

  • First part is duplicate post I resolved on the other post. Second part usually the sprite is holding the spear as part of the animation, then you have a separate throwing animation. The spear could then be a projectile that spawns from the enemy.

  • Thank you. I'll have a try at implementing it in and if it doesn't work I'll post another reply

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have watched a tutorial on this however there are various issues like the enemy throwing the spear as the movement of the spear isn't similar to a parabola (couldn't figure out how to implement) and the angle of the spear doesn't correlate to the spear as a part of the sprite and I've tried setting the angle to the angle of motion. Here's an image for reference:

  • The adjustment of the time for the wait action just makes the cooldown of the bullets slower but still doesn't resolve the issue. If anyone can, could you please send an example of the code required and explain it on the forum, it would be extremely appreciated and I am very thankful of the help I have received so far. I hope I explained the issue well enough.

    Also here is what the movement of the spear should look like:

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