How do I make the jumping animation work?

From the Asset Store
Ninja char for your game! Make your own Shinobi game with this art.
  • I'm making my first game, and I've already had a few problems.

    The first one is still a problem, but I realized that I don't need that mechanic anyways, so I'm scrapping it.

    But the problems I'm actually concerned about are as follows regarding animations.

    When I jump, then land, the jump animations hold on the last frame until I move again. When I land on a platform, my running animation won't stop. On top of that, when I slide off of a platform, my running animation doesn't cancel.

    I've also provided a screenshot of the event sheet.

  • In the last event try replacing "On stopped" condition with "Platform is NOT moving".

    (Add "Is moving" condition, then right-click it and select Invert to change it to "Is NOT moving")

  • Thank you so much. I wish I knew about the invert function sooner.

    You think the invert will work with the "send signal" function?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not sure what you mean.

    You need to know that there are two types of events in Construct. "On stopped" is a triggered event, it's only executed once when the character stops. Most such events start with "On .."

    "Is (not) moving" is a condition which is executed as long as it's true. If the character is not moving, this event will continue firing about 60 times per second. So if you are planning to send any signal in this event, be aware that it may be sent multiple times. You can add another condition, like "Animation Idle is not playing" to prevent this from happening.

  • Gotcha, gotcha. That helps, actually.

    However, the question I'm trying to ask is if there's something along the lines of "when I receive signal" that can be used by any sprite?

    That would some things easier.

  • Depends on your task. The easiest way to do this is with an instance variable - so called "state machine". Add variables to your object, for example isAttacking, isPatrolling etc. Check when object enters each state on every tick. However, I am not a big fan of this method, if you have many objects and many variables, the code will quickly become complicated and difficult to manage. It may also be bad for performance.

    You can also use Timer behavior or triggers like "On animation ended".

  • You mean something like "on ended"?

  • Possibly. You need to explain what you are trying to achieve.

  • You see, I hail from the world of not knowing jack about code, and that's what brought me to Construct. I was surprised when I saw how similar it was to my old childhood experience with Scratch, but was disappointed to find something like "send signal a", "when I receive signal a, do this", etc. There are similar things, but it's not as straightforward.

    I'm just personally familiar with that, so back in scratch, I'd have darn near everything send a signal so I can confirm that something will happen, but that's just not possible it seems.

  • You can't send a signal to an object. The closest to this I think would be creating a function and passing Object.UID to it.

    There are a few fundamental concepts in Construct. All events (except for triggers and functions) are executed from top to bottom on every tick. Many events pick object instances, and any actions inside this event will only affect the picked scope. It's a clever and powerful system and once you get a grasp of it, you'll be able to create big and complex games.

  • Oh I didn't know it went top to bottom. Interesting. That could be useful.

    I appreciate all the help!

  • Oop, I broke it.

    So I want to implement a wall-jump, but I figured that I'd need to do some reworking to get it right. I manually assigned key to move the player to avoid confusion, and thus broke the jump animation once again.

    When the player jumps, it works just fine, but when I press either of the arrow keys, it switches to only the first frame of the run cycle. Not to mention, if I don't include the "is jumping", the jumping animation loops for some reason.

    I was hoping to NOT put "is jumping" so I can make room for a wall jump animation.

  • Some comments on the forum disappear, so I'm reposting it again:

    Yeah, the logic for assigning animations in a platformer game may be quite complex. I suggest you break it into events with sub-events.

    For example:

    Player is on the Floor
    	Player is moving -> Set "Run" animation
    	Player is not moving -> Set "Idle" animation
    Player is NOT on the Floor
    	Player is jumping -> Set "Jump" animation
    	Player is falling -> Set "Fall" animation
    	Player has wall on left/right -> Set "WallClimb" animation
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)