How do I Create clever Enemy

0 favourites
  • 11 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hi, when enemy see me , i want him to come to my hero and start shoting, but between me and enemy is a gap in the floor. How can the enemy detect there is a gap and jump over it?

  • Use the line of sight behavior and set it to have custom collision detection and make the pit in the floor one of the objects it can't "see" through.

  • The solution I saw in a tutorial was to give them a 'detector' sprite, pinned to the forward bottom corner of the sprite, and if it sees open space? Jump.

    Here's a little demo game I put together: Control are the arrow keys for left, right, and jump; your score goes up every time you hit the switch, and down every time the enemy collides with you.

  • Unnatural20 Not good enough because if you lure the enemy in that gap he cannot chase player. Enemy is stuck and cannot chase anymore

  • Unnatural20 Not good enough because if you lure the enemy in that gap he cannot chase player. Enemy is stuck and cannot chase anymore

    Excuse me? What do you mean, "not good enough"? This is a minigame I put together in five minutes to illustrate "jumping over a gap," not "Here is your game for you."

  • Unnatural20 do not be angry I do apologies if I said something wrong but all I said was if the enemy drops in that place enemy cannot follow player.

  • thank you very much )

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • One possibility to prevent the enemy from jumping, when it can't jump far enough to make it over the gap, you can add two more detector objects, placed even farther out.

    After-gap solid detector

    This detector confirms that there's a near-enough solid object on the other side of the gap, that the enemy could get to it by jumping.

    Notice, though, that this will detect a flat landing spot as a solid, but it will also detect a vertical wall the same way, so it's not good enough by itself. (Unless you don't mind the occasional mid air face-plant into a wall)

    Clear jump path detector

    This detector confirms that there's open air above the landing spot, and open air in the jump arc the enemy would take to get there.

    This helps the enemy distinguish between a true landing spot, and a vertical wall. It also prevents them from jumping if the ceiling is too low to make the jump.

  • i guess there is not easier way , thank you guys,

  • Depending on the complexity of the detection you want to do, instead of using dedicated detector objects, you could try using the "Is overlapping at offset" condition. It will temporarily move your object to an offset from it's current position and test to see if it's overlapping something there, then move the object back to it's original position before any other events run.

  • i will work hard to make it as good as possible, i will post the final result for others

    Here result

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