Platformer - enemies chasing player

0 favourites
  • 5 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hi, still learning, and I'm stuck...

    I'm trying to make a enemy chase the player in a classic platform layout, and can't seem to figure it out. I've tried to play with line of sight and playing around with the conditions like "if player.X > enemy.X -> enemy move right" and "if player.X < enemy.X -> enemy move left" etc... and I've manage to accomplish the enemy following the player. But as soon as I jump with the player on a higher platform, I can't get the enemy to jump on the platform too. It just continues to follow the player sprite on the lower platform... Or if a player jumps across a gap in the platform, the enemy will just follow him and fall through the gap, and won't jump over it.

    Would like to make the enemies chase the player around the layout, jumping along and trying to catch and beat the hell out of the player

    Any tutorial out there, or any advice?

  • Hey Saf!

    Page 7 of the platformer tutorial describes a concept of "EdgeMarkers": ... ame/page-7

    You could use those to trigger the enemies Jump so that they clear gaps and try to continue to follow you.

  • PlayerY<EnemyY

    Enemy on collision with invisible sprite simulate control jump?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah, I've tried to use the invisible "jump" trigger sprites, but they don't work as I expected and would need a ton of them on the level... There are "If wall is on the right" "If wall is on the left", is there something like "If edge is on the right"?

    I've also tried something like:

    "If Player.Y > Enemy.Y -> Enemy jump" but if the player is "under" the enemy, for example, the enemy is on top platform and the player on bottom platform, again, the enemy will just try to equalize the X and won't try to find an edge to "fall" down on lower platform...

    Would really love some solution like "Pathfinding" but with "Platformer movoement" in mind and not "8 direction movement"... Wouldn't that be great?!

  • saf , That would be indeed great and insanely difficult to do at the same time. Taking into account all the jumping trajectories and all the complexity that the solids/jump-through platforms could have, is just insane! I bet that for the most part the poor CPU will jump like crazy trying to avoid 1 px overlaps and smashing it's head on narrow height corridors.

    For the most part, using triggers to set gaps, slopes, edges and stuff will do. For logic that decides which way should be more practical for the AI to go, then you'll cave to hardcore those parts by occasion. There isn't a make AI button (unfortunately) and AI is probably the most difficult thing to make!

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