Platformer - enemies chasing player

Get help using Construct 2

Post » Sun Nov 02, 2014 11:27 pm

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 :D

Any tutorial out there, or any advice?
Image
B
7
S
1
Posts: 70
Reputation: 843

Post » Sun Nov 02, 2014 11:35 pm

Hey Saf!

Page 7 of the platformer tutorial describes a concept of "EdgeMarkers": https://www.scirra.com/tutorials/253/ho ... ame/page-7

You could use those to trigger the enemies Jump so that they clear gaps and try to continue to follow you.
B
33
S
10
G
4
Posts: 48
Reputation: 3,491

Post » Sun Nov 02, 2014 11:41 pm

PlayerY<EnemyY
Enemy on collision with invisible sprite simulate control jump?
Image
B
65
S
23
G
7
Posts: 1,502
Reputation: 10,890

Post » Mon Nov 03, 2014 9:26 am

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?!
Image
B
7
S
1
Posts: 70
Reputation: 843

Post » Mon Nov 03, 2014 10:01 am

@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!
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829


Return to How do I....?

Who is online

Users browsing this forum: charliesan763 and 5 guests