Turning Animations on and off

This forum is currently in read-only mode.
  • As far as creating animations go, I know what I'm doing. But how would I make a character play a run animation when a key is held and stop the on release of the key?

  • I happen to have a tutorial .cap for this very occasion. Check it, yo:

    HowToRun.cap

    Edit: In case it isn't immediately apparent how to get the "not equals" sign in front of a condition, you right-click on it and select "Invert condition."

  • Thanks a lot!

    I wish I had known about the inverse function a long time ago.

    One question though, since I'm making my own controls would you happen to have any ideas as how to simulate 'player is moving'? I've been trying to do it for a while but nothing seems to work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, the "set ignoring input" and "stop ignoring input" are just in the .cap to keep the character from moonwalking when both keys are down. It's a side-effect of the default platform movement. If you're making your own controls then you probably won't have to worry about it.

    But just in case, you can assume it's moving when the move keys are down. That would be the most simple way.

    Or you could put in a couple variables called "lastX" and "lastY." Before your movement routine, put the player's X and Y coordinates in them. After your movement routine, check the player's X and Y coordinates against them. If they're different, the player has moved. If X is bigger than lastX then the player has moved right, and if Y is less than lastY then the player has moved up, etc.

  • Well I'm trying to mimic your example but I must be missing something crucial because I can't even get one direction to work.

    Link to .cap.

  • Ah never mind. I got it to work. Though I have to ask, what exactly is the purpose of having those angles?

  • They override sprite rotation. If you only had a sprite drawn for angle 0 and told Construct to change the angle to 180 when going left, then your sprite would be upside down. Making a sprite specifically for 180 degrees counters that.

  • Alright then. I suppose I should use that method. I'm already setting separate animations for different directions. Oh well.

    Thank you for all your help though.

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