How do I add hit and sit actions using "platform behavior"?

0 favourites
  • 6 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Hi! I am beginner in construct 2 and in gamedev also.

    I'm making simple game: 2D platformer fight where both players can perform next actions: move, jump, sit and attack (both during jump and stand).

    l'm using "spriter" to make animations.

    I've already made movement (move and jump) using video "Using Spriter animation files in construct2" (i've made the same events).

    And now i have problem with adding sit and hit animations.

    Events like "Player is on floor & hit button pressed -> set animation to "hit" doesn't work, sprite just standing. (it looks like he begins to play hit animations, but immediately begin to play stand animation). I've spent several hours and don't know what to do and i'm looking for help

    Thanks in advance! (and sorry if there are already this question on forum)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How do you trigger the 'stand animation' ? Is the condition that makes it start to play kinda always true ?

  • Event:system vector(x)=0, player is on floor, animation not equal stand. Action: set animation to:stand from current ratio (as in tutorial:)

  • So the answer to my question is YES, kinda.

    You have to learn to read your conditions, you need to know when they are true.

    The standing animation runs when v=0 (speed is zero), when the platform is on the floor and when idle is not playing. Those conditions are still all true when you press a key. So at the moment, when you trigger a hit animation you also trigger a stand animation.

    This means that the trigger for the stand animation needs a condition more to stop it from playing during the hit animation. You know how to do that, you did it allready whit the idle animation.

  • I had this same problem in my game and I got around it by adding an instance boolean to the player sprite called overrideAnimations and then testing to see if it wasn't true. eg

    if player is on floor & overrideAnimations = false : set animation to "Stand"

    player presses "hit" key: set overrideAnimations to true, play animation "Hit"

    animation "Hit" is finished: set overrideAnimations to false

  • Thank you for help! Now i make hit animation during standing (using your advice) and i even make hit during jump using the same thing (but somehow it doesn't work when flipped - but it's lesser problem).

    Main problem is i cannot make hit during walk. I've tried the same method but it doesnot work.

    Walk event is next: player1VectorX>0, player1 is on floor, animation not equal to "hitwalk". Action: set animation to walk

    Hitwalk event: player1 is on floor, space pressed. Action: set animation to hitwalk.

    I think the problem is in conditions again but i dont know where..


    Maybe you can give advice how to understand conditions better? Because now i can make something works

    only using tutorials and videos. When i try to make something myself it doesn't work in 90% of cases

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