Need example for enemy AI in beat'em'up game

This forum is currently in read-only mode.
From the Asset Store
Give Sound to the enemies that are part of your game! :)
  • Hi everyone! I'm currently working on a beat'em'up game, like good old "Double Dragon". I'm noob in Construct so I need help with enemy AI. I want enemy to come to a certain distance towards player and then attack him in melee. In fact enemy must chase player, get close to him, attack, continue chasing if player got away. If anyone could help with example .cap file my gratitude will be epic

  • Since I'm new it would take a long time to make an example up, but you should be able to detect whether the enemy is close enough using something like this:

    <img src="http://dl.dropbox.com/u/19777553/forum%20images/Untitled-1.jpg">

    That's what I used in my rpg to detect whether a caveman is close enough for the hero to talk to. As for chasing I'm working on the same thing, experimenting with bullet and 8-dir behaviors. Leaning towards bullet. You can set the enemy's angle towards the player every X ticks and set it to move forward till its in range.

  • You could simplify that by using sprite -> pick by comparison -> distance(.x, .y, Sprite2.x, Sprite2.y) is less than however many pixels. You could also use a pick closest condition with that to make sure you get the closest one.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Will your game be on a single platform like Streets of Rage or Final Fight, or will there by vertical movement like Double Dragon? Vertical movement, such as how the enemy's in Double Dragon climb up and down ladders to get to you, will require more complex AI.

  • Will your game be on a single platform like Streets of Rage or Final Fight, or will there by vertical movement like Double Dragon? Vertical movement, such as how the enemy's in Double Dragon climb up and down ladders to get to you, will require more complex AI.

    That said, the distance for a 3D displacement would be something like:

    sqrt((Player.X - Enemy.X)^2 + (Player.Y - Enemy.Y)^2 + (Player.ZElevation - Enemy.ZElevation)^ 2[/code:11zysxf8]
    
    You could then use the Line Of Sight behaviour from the base of the enemy to the base of the player to see if there are any obsticals in the way, if not then have them move towards the player.
  • You could simplify that by using sprite -> pick by comparison -> distance(.x, .y, Sprite2.x, Sprite2.y) is less than however many pixels. You could also use a pick closest condition with that to make sure you get the closest one.

    Awesome I'll do that!

  • Thanks a lot! I'll try.

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