How to have one action triggered by two buttons?

0 favourites
  • 4 posts
From the Asset Store
7 Dark mystery music ranging from a piano arrangement to full orchestral pieces.
  • Hi, I'm making a Castlevania-esque game, I've got the attacks down good but I can't seem to get a crouching attack to work? I've tried doing it as :

    Keyboard Space is pressed : Player Set animation to "[name of animation]" (play from beginning)

    Keyboard S is down :

    I have no clue what I'm doing wrong, when I 'tie' the animation trigger to one other random button it works but no with this specific combination? Am I just being dumb? I thought it might be that pressing Space triggers the regular attack but I didn't think that would matter ?

    Thanks for any help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not really understand the events you've written but with animations you have to be careful that several things are not true at the same time or it'll cancel out one of them and you'll never see the animation. If you have an event that says on crouch button pressed, play crouch animation then it'll always play it when crouched regardless of any other buttons pressed.

    You can filter it out with variables/states for the player. When you are crouching you say player isCrouching=true. Then you have logic isCrouching then play crouch animation. If you also press attack then you have logic isAttacking=true. Then you can have an event if isCrouching and isAttacking play crouch attack animation. The previous event for isCrouching=true then becomes if isCrouching and not isAttacking which would just play the idle crouching animation. It's just about making sure more than one condition is not true when you are playing the animations.

  • Are you using states? Speaking as someone who started off just dumping all my character controls into a single event sheet, I can tell you from learning the hard way that not segmenting your player controls into states will blow up in your face eventually xD

    For the crouching attack itself, I'd suggest using Is key down (down arrow), then as a sub event, on key pressed (whatever the attack button is), trigger the animation.

    Without putting crouch controls into it's own state though, you'll have to add a Is key not down (down arrow) condition to your standing attack, otherwise you'll have conflicts.

  • If I understand correctly, can right-click an event and select "Make OR block" and then if your event has multiple conditions, the action will only occur if just one or more of those conditions are true, instead of all of them.

    I just made up an event, here is an example of what my example event looks like with and without the "Make OR block":

    Without:

    Player > On collision with another object > Lava >

    Player > Is jumping > System > Restart Layout

    Player > Is on ground (Inverted) >

    With this one, the layout will only be restarted if the player collides with lava while jumping and not on the ground.

    With:

    (I know this wouldn't be playable but it's just an example)

    Player > On collision with another object > Lava

    OR

    Player > Is jumping > System > Restart Layout

    OR

    Player > Is on ground (Inverted)

    With this one, the layout will be restart if the player collides with lava, isn't on the ground, or is jumping, rather than if all 3 conditions are met.

    I hope I understood your problem correctly and I helped,

    -The Diaper Movie

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