How can i make my AI enemy jump when needed to follow player

0 favourites
  • 3 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • hi there,

    im coding a scrolling platformer and have tried using conditional logic for my enemy AI to move towards my player - it seems to work well with the attack process initiated within a specific sprite proximity.

    everything works great but i would like the AI to have the ability to follow my player by using jump. my player jumps from rooftop to rooftop and the AI just falls off the roof when trying to follow my player to the next building.

    I could define a transparent sprite on the edge of the building and when the enemy collides; initiate a jump - that would probably work, but i was hoping someone could suggests a cleaner / more refined solution?

    thank you kindly, regards, ronnie

    Tagged:

  • Trigger sprites is good. You could also use Raycasting to determine if there is a building infront of the enemy or if they have approached a precipice.

    You could cast a Ray at short intervals at 0°(to detect building in front) and at something like 75° to detect lack of ground in front (you would have to think of something for large downward steps). You would set the raycast distance to an appropriate value.

    If the ray is not intersected you trigger your jump actions.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • thank you very much for your reply and great suggestion. im not familiar with ray casting but will definitely upskill on it. thanks again! regards, ronnie

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