How do I Implement combo pressing and AI enemy stop 2 attack

0 favourites
  • 6 posts
From the Asset Store
Combo
$10 USD
Button Combinations like in fightings, supports both keyboard and gamepads
  • Practicing the platform beat em' up.

    My goal is to earn new combo moves.

    I currently have "D" pressed and player kicks.

    Once "X" amount of items are collected, the kick combo 1 is activated.

    The player presses D&S simultaneously and three series of kicks are triggered.

    So, here lies my first obstacle for this and future combos.

    1. I would like the combo kicks only to work in sequence when the player presses the assigned button 3 separate times within "X" amount of seconds between each press, otherwise the combo sequence stops. Each specific kick will trigger each time the button is pressed.

    EXAMPLE: Press D to trigger first kick, Press D (within X amount of time) to trigger second type of kick, Press D and Up (within X amount of time) to trigger final kick in the combo sequence.

    2. I have the AI set to instance variables. 0=IDLE, 1=Walk Right, 2= Walk Left, 3= Walk Right w/ faster max speed, 4=Walk Left w/faster max speed. The enemy follows my player, but only stops when directly overlapping him. Multiple enemies do the same so its all one glob.

    I am trying the enemy.x> or <player.x to stop, but I need for enemies to not overlap one another, stop just prior to player and attack.

    Also, if the player can attack faster than enemy, then enemy stops attack and goes in "taking a hit" mode.

    I will start with that. I've learned much from the mass tutorials and forum posts, but this one seems to slip.

    thanks in advance.

  • I am not very good with this program yet, so my ideas might not work, and there might be a better way of doing things.

    1. For your combo request, you could spawn an invisible object [let's call this object "kick"] off to the side when D is pressed, and you could also have a condition to check how many "kick"s there are when you press D. (This can differentiate your kicks when they are in a sequence.) When object "kick" is created you can make it wait X seconds before it's destroyed. You can do the same thing for other buttons like the up arrow.

    2. For your AI issue, you could check the distance between your enemy and your player so if the distance is less than 100 pixels, your enemy stops. Set this as a condition with the system comparing values function distance(player.X, enemy.X) <100 set instance variable = 5 (5 could be your stop function.)

    To make the enemies stop and take a hit, you could set up a new instance variable called "attacktime". It's initial value could be 3, and every 1 second you subtract 1 from "attacktime". Create an event to set this variable back to 3 if the enemy is hit.

    I really hoped this helped. I want to play this game when it's done

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • CuriousTaco I will attempt to give it a try. Right now, I'm stuck on trying to make my player with platform behavior to go from walk to run. I would like to have the player press down on the right button and he walks and when you want the player to run you release the button, but within x amount of time, you press and hold down the button again and it triggers the run.

    I've been adding variables so it adds or subtracts on button presses, and if it reaches a certain number it should trigger player to run. The variables work (looking via debug mode), but since platform speed doesn't have a set speed behavior only set max speed, I can't get it or the run animation to trigger.

  • I'll suggest you the easiest way:

    Setup your combo animations to not loop. Setup an instance variable to the player and call it by Combo.

    On the event sheet, you'll need to setup the follow:

    Condition:

    Player pressed the attack button (A for example);

    Action:

    Set Player.Combo = choose("1", "2", "and so on");

    Sub-Condition 1: Invert (Player is playing "Combo"&Player.Combo);

    Sub-Action 1: Set Player animation to "Combo" & Player.Combo (where the first "Combo" is the combo animation name);

    Sub-Condition 2: Else AND Player animation frame = Player.AnimationFrameCount;

    Sub-Action 2: Set Player animation to "Combo" & Player.Combo (where the first "Combo" is the combo animation name);

    Condition:

    Invert it (is Pressing Attack Key) AND Player animation = "Combo" & Player.Combo AND Player animation finished;

    Action: Player.Combo = 0;

    I do believe it need some adjustments but will give you the idea.

    The problem with combo is:

    The player should press a key to start attack, but, it also need to check if the player is not performing an attack already, if not, start, else, wait it finish and attack again.

    To check it, you should make an instance variable where you'll store the combo number and check over the animation combo index if he is performing it.

    If you want give the player the right of perform the same attack in a subsequent combo, you should improve this code.

  • Thanks again for stepping in. I'm going to give it a shot. I just figured out the run/walk triggers for the platform areas of the game and trying to tackle another issue with climbing and descending ladder/poles. I can ascend, but can't cross over to the top solid platform since my pinned shadow (with platform behavior) gets caught and trying to pause the character in mid climb if UP (Jump/CLIMB) button is released during mid-climb. Once I get that and a few more, I'm going to concentrate on the combos more and attempt your suggestion. Thanks.

    CuriousTaco - Forgot to say thanks for you interest and glad you are excited to play it. Unfortunately, the programmer who was excellent had things come up and couldn't commit, which is understandable in life. So, as a complete novice at this, I'm trying to do everything. I have basically all the animations done now though, so I can really focus on the coding. I almost got the first cut-scenes to work the way I want to as well. I still have a goal of making this a co-op game as well. Someday...someday.

  • If you're using jump-thru platforms, just check if the player is overlapping it with a vertical offset, so, you'll make him go upper and he will simple fall over the platform with the platform behavior. Make sure to check the climbing events are not triggering when the player is out of the ladder, rope, etc.

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